Class: UcbGroups::MembershipFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/ucb_groups/membership_finder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(namespace) ⇒ MembershipFinder

Returns a new instance of MembershipFinder.



5
6
7
# File 'lib/ucb_groups/membership_finder.rb', line 5

def initialize(namespace)
  @namespace = namespace
end

Instance Attribute Details

#groupsObject

Returns the value of attribute groups.



3
4
5
# File 'lib/ucb_groups/membership_finder.rb', line 3

def groups
  @groups
end

#namespaceObject

Returns the value of attribute namespace.



3
4
5
# File 'lib/ucb_groups/membership_finder.rb', line 3

def namespace
  @namespace
end

#orgsObject

Returns the value of attribute orgs.



3
4
5
# File 'lib/ucb_groups/membership_finder.rb', line 3

def orgs
  @orgs
end

Instance Method Details

#find(*options) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ucb_groups/membership_finder.rb', line 9

def find(*options)
  @groups, @orgs = parse_options(options)

  return [] if @groups.empty? && @orgs.empty?

  ensure_valid_options

  args = {
      base: "ou=people,dc=berkeley,dc=edu",
      filter: membership_filter,
      attributes: Person.ldap_attributes
  }

  LdapConn.conn.search(args).map { |entry| Person.new(entry) }
end