summaryrefslogtreecommitdiff
path: root/app/models/user.rb
diff options
context:
space:
mode:
authorTiago Botelho <tiagonbotelho@hotmail.com>2017-09-25 18:07:45 +0100
committerTiago Botelho <tiagonbotelho@hotmail.com>2017-10-02 11:35:09 +0100
commit011c168bff7174ce4b2defe239aa8d5031aa8269 (patch)
tree3cf09368b4bd58fd2477a43f99c8a7d253da687e /app/models/user.rb
parentcd85a558dc3e568b327e2b0502b59b34d17b19bd (diff)
downloadgitlab-ce-011c168bff7174ce4b2defe239aa8d5031aa8269.tar.gz
Refactors SAML identity creation in gl_user.
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 09c9b3250eb..fc81a4fc27d 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -690,7 +690,11 @@ class User < ActiveRecord::Base
end
def ldap_user?
- identities.exists?(["provider LIKE ? AND extern_uid IS NOT NULL", "ldap%"])
+ if identities.loaded?
+ identities.find { |identity| identity.provider.start_with?('ldap') && !identity.extern_uid.nil? }
+ else
+ identities.exists?(["provider LIKE ? AND extern_uid IS NOT NULL", "ldap%"])
+ end
end
def ldap_identity