Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-02-15 12:27:39 +0300
committerMark Fletcher <mark@gitlab.com>2018-02-19 14:13:33 +0300
commitdf81934fb0e8e6c8a959cfa3b11bc8f48774eb7e (patch)
tree317d5bde3d1c82497c08030c355324ea8ab319d5 /lib
parentdcd1a43faf9654bf6e36d47d88dc914a100c4e33 (diff)
Merge branch 'fj-37528-error-after-disabling-ldap' into 'master'
Fixed user synced attributes metadata after removing current provider Closes #37528 See merge request gitlab-org/gitlab-ce!17054
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/ldap/config.rb2
-rw-r--r--lib/gitlab/o_auth/user.rb8
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/gitlab/ldap/config.rb b/lib/gitlab/ldap/config.rb
index 47b3fce3e7a..a6bea98d631 100644
--- a/lib/gitlab/ldap/config.rb
+++ b/lib/gitlab/ldap/config.rb
@@ -15,7 +15,7 @@ module Gitlab
end
def self.servers
- Gitlab.config.ldap.servers.values
+ Gitlab.config.ldap['servers']&.values || []
end
def self.available_servers
diff --git a/lib/gitlab/o_auth/user.rb b/lib/gitlab/o_auth/user.rb
index a3e1c66c19f..ed5ab7b174d 100644
--- a/lib/gitlab/o_auth/user.rb
+++ b/lib/gitlab/o_auth/user.rb
@@ -198,9 +198,11 @@ module Gitlab
end
def update_profile
+ clear_user_synced_attributes_metadata
+
return unless sync_profile_from_provider? || creating_linked_ldap_user?
- metadata = gl_user.user_synced_attributes_metadata || gl_user.build_user_synced_attributes_metadata
+ metadata = gl_user.build_user_synced_attributes_metadata
if sync_profile_from_provider?
UserSyncedAttributesMetadata::SYNCABLE_ATTRIBUTES.each do |key|
@@ -221,6 +223,10 @@ module Gitlab
end
end
+ def clear_user_synced_attributes_metadata
+ gl_user.user_synced_attributes_metadata&.destroy
+ end
+
def log
Gitlab::AppLogger
end