summaryrefslogtreecommitdiff
path: root/app/models/user.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-10-02 15:24:48 +0000
committerDouwe Maan <douwe@gitlab.com>2017-10-02 15:24:48 +0000
commitb40192a9464503bf4b141f8cf6133d7ba0f893fe (patch)
treeb88f2ecfa2a6d0eca0e00dc09d30dcc16af4d32b /app/models/user.rb
parent4716e81f9dc73b95e45df26fd339b75aaf6b48f6 (diff)
parent011c168bff7174ce4b2defe239aa8d5031aa8269 (diff)
downloadgitlab-ce-b40192a9464503bf4b141f8cf6133d7ba0f893fe.tar.gz
Merge branch '33493-attempt-to-link-saml-users-to-ldap-by-email' into 'master'
Attempt to link saml users to ldap by email Closes #33493 See merge request gitlab-org/gitlab-ce!14216
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 4d523aa983f..e5f345e93ae 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -692,7 +692,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