Fixed bug #1088: Changed LDAP entry check to support Novell eDirectory.
This commit is contained in:
parent
79a4f2972a
commit
c5d3052e39
1 changed files with 6 additions and 6 deletions
12
lib/ldap.rb
12
lib/ldap.rb
|
@ -75,8 +75,6 @@ class Ldap
|
||||||
attributes: attributes,
|
attributes: attributes,
|
||||||
return_result: false, # improves performance
|
return_result: false, # improves performance
|
||||||
) do |entry|
|
) do |entry|
|
||||||
# needed for the #entries? method -> returns nil on break
|
|
||||||
break if !block_given?
|
|
||||||
yield entry
|
yield entry
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -91,10 +89,12 @@ class Ldap
|
||||||
#
|
#
|
||||||
# @return [Boolean] Returns true if entries are present false if not.
|
# @return [Boolean] Returns true if entries are present false if not.
|
||||||
def entries?(*args)
|
def entries?(*args)
|
||||||
# since #search returns nil if entries are found (due to the break in the yield block)
|
found = false
|
||||||
# and returns true otherwise we have to invert the result which matches the
|
search(*args) do |_entry|
|
||||||
# expected result of a ...? method and suites our needs since it checks one entry max.
|
found = true
|
||||||
!search(*args)
|
break
|
||||||
|
end
|
||||||
|
found
|
||||||
end
|
end
|
||||||
|
|
||||||
# Counts the entries for the given search criteria.
|
# Counts the entries for the given search criteria.
|
||||||
|
|
Loading…
Reference in a new issue