Commit 5a616649b549eafc082ad876ac086da8945217f2
1 parent
50670948
Exists in
spb-stable
and in
3 other branches
Allow passing an adapter to Gitlab::LDAP::Person
Showing
1 changed file
with
6 additions
and
4 deletions
Show diff stats
lib/gitlab/ldap/person.rb
1 | 1 | module Gitlab |
2 | 2 | module LDAP |
3 | 3 | class Person |
4 | - def self.find_by_uid(uid) | |
5 | - Gitlab::LDAP::Adapter.new.user(config.uid, uid) | |
4 | + def self.find_by_uid(uid, adapter=nil) | |
5 | + adapter ||= Gitlab::LDAP::Adapter.new | |
6 | + adapter.user(config.uid, uid) | |
6 | 7 | end |
7 | 8 | |
8 | - def self.find_by_dn(dn) | |
9 | - Gitlab::LDAP::Adapter.new.user('dn', dn) | |
9 | + def self.find_by_dn(dn, adapter=nil) | |
10 | + adapter ||= Gitlab::LDAP::Adapter.new | |
11 | + adapter.user('dn', dn) | |
10 | 12 | end |
11 | 13 | |
12 | 14 | def initialize(entry) | ... | ... |