diff --git a/lib/gitlab/ldap/person.rb b/lib/gitlab/ldap/person.rb index 5ee383dfa03..06b17c58f8c 100644 --- a/lib/gitlab/ldap/person.rb +++ b/lib/gitlab/ldap/person.rb @@ -1,12 +1,14 @@ module Gitlab module LDAP class Person - def self.find_by_uid(uid) - Gitlab::LDAP::Adapter.new.user(config.uid, uid) + def self.find_by_uid(uid, adapter=nil) + adapter ||= Gitlab::LDAP::Adapter.new + adapter.user(config.uid, uid) end - def self.find_by_dn(dn) - Gitlab::LDAP::Adapter.new.user('dn', dn) + def self.find_by_dn(dn, adapter=nil) + adapter ||= Gitlab::LDAP::Adapter.new + adapter.user('dn', dn) end def initialize(entry)