Class: GitHub::Ldap::UserSearch::Default

Inherits:
Object
  • Object
show all
Includes:
Filter
Defined in:
lib/github/ldap/user_search/default.rb

Overview

The default user search strategy, mainly for allowing Domain#user? to search for a user on the configured domain controller, or use the Global Catalog to search across the entire Active Directory forest.

Direct Known Subclasses

ActiveDirectory

Constant Summary

Constants included from Filter

Filter::ALL_GROUPS_FILTER, Filter::MEMBERSHIP_NAMES

Instance Method Summary collapse

Methods included from Filter

#all_members_by_uid, #group_contains_filter, #group_filter, #login_filter, #member_filter, #members_of_group, #posix_member_filter, #subgroups_of_group

Constructor Details

#initialize(ldap) ⇒ Default

Returns a new instance of Default.



10
11
12
13
14
15
16
17
# File 'lib/github/ldap/user_search/default.rb', line 10

def initialize(ldap)
  @ldap = ldap
  @options = {
    :attributes => [],
    :paged_searches_supported => true,
    :size => 1
  }
end

Instance Method Details

#perform(login, base_name, uid, search_options) ⇒ Object

Performs a normal search on the configured domain controller using the default base DN, uid, search_options



21
22
23
24
25
# File 'lib/github/ldap/user_search/default.rb', line 21

def perform(, base_name, uid, search_options)
  search_options[:filter] = (uid, )
  search_options[:base] = base_name
  search(options.merge(search_options))
end

#search(options) ⇒ Object

The default search. This can be overridden by a child class like GitHub::Ldap::UserSearch::ActiveDirectory to change the scope of the search.



30
31
32
# File 'lib/github/ldap/user_search/default.rb', line 30

def search(options)
  ldap.search(options)
end