Allow passing an adapter to Gitlab::LDAP::Person

This commit is contained in:
Jacob Vosmaer 2014-03-14 08:52:57 +01:00
parent 506709485c
commit 5a616649b5
1 changed files with 6 additions and 4 deletions

View File

@ -1,12 +1,14 @@
module Gitlab module Gitlab
module LDAP module LDAP
class Person class Person
def self.find_by_uid(uid) def self.find_by_uid(uid, adapter=nil)
Gitlab::LDAP::Adapter.new.user(config.uid, uid) adapter ||= Gitlab::LDAP::Adapter.new
adapter.user(config.uid, uid)
end end
def self.find_by_dn(dn) def self.find_by_dn(dn, adapter=nil)
Gitlab::LDAP::Adapter.new.user('dn', dn) adapter ||= Gitlab::LDAP::Adapter.new
adapter.user('dn', dn)
end end
def initialize(entry) def initialize(entry)