From d96d9aae42705aeb14da9c9dcd6b52db8fcb1f6b Mon Sep 17 00:00:00 2001 From: Alex Lossent Date: Wed, 17 Jun 2015 18:06:27 +0200 Subject: 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. --- lib/gitlab/o_auth/user.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/gitlab/o_auth/user.rb') 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 -- cgit v1.2.1