diff options
author | Alex Lossent <alexandre.lossent@cern.ch> | 2015-06-17 18:06:27 +0200 |
---|---|---|
committer | Alex Lossent <alexandre.lossent@cern.ch> | 2015-06-17 18:06:27 +0200 |
commit | d96d9aae42705aeb14da9c9dcd6b52db8fcb1f6b (patch) | |
tree | 79416a8461e4eeff132f02a5f0ac0d0427c82ebe /lib/gitlab/o_auth | |
parent | 79e24886ec54d79c6e8658fa7f82de8361adfd0d (diff) | |
download | gitlab-ce-d96d9aae42705aeb14da9c9dcd6b52db8fcb1f6b.tar.gz |
Fix behavior of ldap_person method in Gitlab::OAuth::User
Code tweaks in 45e9150a caused the ldap_person method to not return expected results.
Improved tests to cover the ldap_person method, which was previously stubbed.
Diffstat (limited to 'lib/gitlab/o_auth')
-rw-r--r-- | lib/gitlab/o_auth/user.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/gitlab/o_auth/user.rb b/lib/gitlab/o_auth/user.rb index c4971b5bcc6..17ce4d4b174 100644 --- a/lib/gitlab/o_auth/user.rb +++ b/lib/gitlab/o_auth/user.rb @@ -87,12 +87,13 @@ module Gitlab def ldap_person return @ldap_person if defined?(@ldap_person) - # looks for a corresponding person with same uid in any of the configured LDAP providers - @ldap_person = Gitlab::LDAP::Config.providers.find do |provider| + # Look for a corresponding person with same uid in any of the configured LDAP providers + Gitlab::LDAP::Config.providers.each do |provider| adapter = Gitlab::LDAP::Adapter.new(provider) - - Gitlab::LDAP::Person.find_by_uid(auth_hash.uid, adapter) + @ldap_person = Gitlab::LDAP::Person.find_by_uid(auth_hash.uid, adapter) + break if @ldap_person end + @ldap_person end def ldap_config |