diff options
author | Francisco Javier López <fjlopez@gitlab.com> | 2018-02-15 12:27:38 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-02-15 12:27:38 +0300 |
commit | 26af0e2d601401114a0574203a56f5f71417adf3 (patch) | |
tree | 71c316455f3e11444b5d24b5ccee302c81cde238 /lib | |
parent | 16ca6914f622ce7ddf116173293c6f49a93092bc (diff) |
Fixed user synced attributes metadata after removing current provider
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 |