summaryrefslogtreecommitdiff
path: root/app/models/user_synced_attributes_metadata.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/user_synced_attributes_metadata.rb')
-rw-r--r--app/models/user_synced_attributes_metadata.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/app/models/user_synced_attributes_metadata.rb b/app/models/user_synced_attributes_metadata.rb
index 5aacf11b1cb..4cceffda19e 100644
--- a/app/models/user_synced_attributes_metadata.rb
+++ b/app/models/user_synced_attributes_metadata.rb
@@ -14,7 +14,7 @@ class UserSyncedAttributesMetadata < ApplicationRecord
def read_only_attributes
return [] unless sync_profile_from_provider?
- SYNCABLE_ATTRIBUTES.select { |key| synced?(key) }
+ self.class.syncable_attributes.select { |key| synced?(key) }
end
def synced?(attribute)
@@ -25,6 +25,20 @@ class UserSyncedAttributesMetadata < ApplicationRecord
write_attribute("#{attribute}_synced", value)
end
+ class << self
+ def syncable_attributes
+ return SYNCABLE_ATTRIBUTES if sync_name?
+
+ SYNCABLE_ATTRIBUTES - %i[name]
+ end
+
+ private
+
+ def sync_name?
+ Gitlab.config.ldap.sync_name
+ end
+ end
+
private
def sync_profile_from_provider?