Permalink
Browse files

Temporary changes

  • Loading branch information...
1 parent afd4ee7 commit 8ac003d31fac0042526696e8ffcba5426c1cce2c @bowmande committed Apr 5, 2011
Showing with 17 additions and 0 deletions.
  1. +13 −0 lib/devise_ldap_authenticatable/ldap_adapter.rb
  2. +4 −0 lib/devise_ldap_authenticatable/model.rb
@@ -56,6 +56,14 @@ def self.begins_with(login)
resource = LdapConnect.new(options)
resource.search
end
+
+ def self.displayname_begins_with(name)
+ options = {:ldap_auth_username_builder => ::Devise.ldap_auth_username_builder,
+ :admin => ::Devise.ldap_use_admin_to_bind}
+
+ resource = LdapConnect.new(options)
+ resource.begins_with("displayname", name)
+ end
class LdapConnect
@@ -97,6 +105,11 @@ def search
filter = Net::LDAP::Filter.eq(@attribute.to_s, @login.to_s + "*")
@ldap.search(:filter => filter)
end
+
+ def begins_with(attribute, value)
+ filter = Net::LDAP::Filter.eq(attribute, value + "*")
+ @ldap.search(:filter => filter)
+ end
def dn
ldap_entry = entry
@@ -89,6 +89,10 @@ def begins_with(login)
def entry_for(login)
Devise::LdapAdapter.get_entry(login)
end
+
+ def ldap_displayname_begins_with(name)
+ Devise::LdapAdapter.displayname_begins_with(name)
+ end
end
end

0 comments on commit 8ac003d

Please sign in to comment.