diff --git a/lib/github/ldap/members/recursive.rb b/lib/github/ldap/members/recursive.rb index 867dda0..9b0becc 100644 --- a/lib/github/ldap/members/recursive.rb +++ b/lib/github/ldap/members/recursive.rb @@ -9,7 +9,7 @@ class Recursive include Filter DEFAULT_MAX_DEPTH = 9 - ATTRS = %w(member uniqueMember memberUid) + DEFAULT_ATTRS = %w(member uniqueMember memberUid) # Internal: The GitHub::Ldap object to search domains with. attr_reader :ldap @@ -17,6 +17,9 @@ class Recursive # Internal: The maximum depth to search for members. attr_reader :depth + # Internal: The attributes to search for. + attr_reader :attrs + # Public: Instantiate new search strategy. # # - ldap: GitHub::Ldap object @@ -25,6 +28,7 @@ def initialize(ldap, options = {}) @ldap = ldap @options = options @depth = options[:depth] || DEFAULT_MAX_DEPTH + @attrs = Array(options[:attrs]).concat DEFAULT_ATTRS end # Public: Performs search for group members, including groups and @@ -95,7 +99,7 @@ def member_entries(entry) # Returns an Array of Net::LDAP::Entry objects. def entries_by_dn(members) members.map do |dn| - ldap.domain(dn).bind(attributes: ATTRS) + ldap.domain(dn).bind(attributes: attrs) end.compact end private :entries_by_dn @@ -106,7 +110,7 @@ def entries_by_dn(members) def entries_by_uid(members) filter = members.map { |uid| Net::LDAP::Filter.eq(ldap.uid, uid) }.reduce(:|) domains.each_with_object([]) do |domain, entries| - entries.concat domain.search(filter: filter, attributes: ATTRS) + entries.concat domain.search(filter: filter, attributes: attrs) end.compact end private :entries_by_uid
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: