lib/acs/ldap/pusher.rb in acs-ldap-0.2.4 vs lib/acs/ldap/pusher.rb in acs-ldap-0.2.5
- old
+ new
@@ -17,10 +17,15 @@
else
create(model)
end
end
+ def index
+ filter = Net::LDAP::Filter.pres('uid')
+ @connector.search({base: base, filter: filter})
+ end
+
def create(model, options = {})
attributes = @mapper.attributes(model).except!(:uid)
attributes.merge!(objectClass: @mapper.object_class)
Acs::Ldap.logger.debug "Pusher#create dn '#{dn(model)}' attributes '#{attributes.inspect}'"
@@ -70,14 +75,11 @@
value
)
end
def count
- count = 0
- @connector.search({base: base}).data.each do |entry|
- count += 1 if entry[:uid].present?
- end
- count
+ filter = Net::LDAP::Filter.pres('uid')
+ @connector.search({base: base, filter: filter}).data.count
end
protected
def ou