summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-06-18 09:36:44 +0000
committerDouwe Maan <douwe@gitlab.com>2015-06-18 09:36:44 +0000
commitffe130d857dbf450d696c0341f03b413a3114d3c (patch)
tree251f352251d49ce1145e763fa2ccc2a93a778252 /lib
parente12b643192a945f5ff40da3dd1883616ae04e8d9 (diff)
parentd96d9aae42705aeb14da9c9dcd6b52db8fcb1f6b (diff)
downloadgitlab-ce-ffe130d857dbf450d696c0341f03b413a3114d3c.tar.gz
Merge branch 'fix/oauth_user_ldap_person' into 'master'
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. Restored the previous implementation of ldap_person, as I could not find a more concise to write it that still works with all the test cases. See merge request !837
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/o_auth/user.rb9
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