diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-10-02 15:24:48 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-10-02 15:24:48 +0000 |
commit | b40192a9464503bf4b141f8cf6133d7ba0f893fe (patch) | |
tree | b88f2ecfa2a6d0eca0e00dc09d30dcc16af4d32b /app/models/user.rb | |
parent | 4716e81f9dc73b95e45df26fd339b75aaf6b48f6 (diff) | |
parent | 011c168bff7174ce4b2defe239aa8d5031aa8269 (diff) | |
download | gitlab-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.rb | 6 |
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 |