@@ -15,23 +15,20 @@ module MembershipValidators
15
15
# nested groups, performed on the server side.
16
16
class ActiveDirectory < Base
17
17
def perform ( entry )
18
- domains . each do |domain |
19
- # search for the entry on the condition that the entry is a member
20
- # of one of the groups or their subgroups.
21
- #
22
- # Sets the entry to the base and scopes the search to the base,
23
- # according to the source documentation, found here:
24
- # http://msdn.microsoft.com/en-us/library/aa746475(v=vs.85).aspx
25
- matched = domain . search \
26
- filter : membership_in_chain_filter ( entry ) ,
27
- base : entry . dn ,
28
- scope : Net ::LDAP ::SearchScope_BaseObject ,
29
- attributes : ATTRS
18
+ # search for the entry on the condition that the entry is a member
19
+ # of one of the groups or their subgroups.
20
+ #
21
+ # Sets the entry to the base and scopes the search to the base,
22
+ # according to the source documentation, found here:
23
+ # http://msdn.microsoft.com/en-us/library/aa746475(v=vs.85).aspx
24
+ matched = ldap . search \
25
+ filter : membership_in_chain_filter ( entry ) ,
26
+ base : entry . dn ,
27
+ scope : Net ::LDAP ::SearchScope_BaseObject ,
28
+ attributes : ATTRS
30
29
31
- return true unless matched . empty?
32
- end
33
-
34
- false
30
+ # membership validated if entry was matched and returned as a result
31
+ matched . map ( &:dn ) . include? ( entry . dn )
35
32
end
36
33
37
34
# Internal: Constructs a membership filter using the "in chain"
0 commit comments