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 | module Gitlab | 1 | module Gitlab |
2 | module LDAP | 2 | module LDAP |
3 | class Person | 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 | end | 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 | end | 12 | end |
11 | 13 | ||
12 | def initialize(entry) | 14 | def initialize(entry) |