diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-02-15 09:27:39 +0000 |
---|---|---|
committer | Mark Fletcher <mark@gitlab.com> | 2018-02-19 11:13:33 +0000 |
commit | df81934fb0e8e6c8a959cfa3b11bc8f48774eb7e (patch) | |
tree | 317d5bde3d1c82497c08030c355324ea8ab319d5 /lib | |
parent | dcd1a43faf9654bf6e36d47d88dc914a100c4e33 (diff) | |
download | gitlab-ce-df81934fb0e8e6c8a959cfa3b11bc8f48774eb7e.tar.gz |
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.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/o_auth/user.rb | 8 |
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 |