summaryrefslogtreecommitdiff
path: root/app/models/user_synced_attributes_metadata.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-12-13 18:02:49 +0100
committerDouwe Maan <douwe@selenight.nl>2017-12-15 12:48:48 +0100
commit481b8a71f8ee63758d26a57a6367c091d4b76b09 (patch)
tree1dad8e2612bdce00ca3b537db648bcd54785a95a /app/models/user_synced_attributes_metadata.rb
parentd673628de003d1ce1402f03311066339828fb811 (diff)
downloadgitlab-ce-481b8a71f8ee63758d26a57a6367c091d4b76b09.tar.gz
Make sure user email is read only when synced with LDAP
Diffstat (limited to 'app/models/user_synced_attributes_metadata.rb')
-rw-r--r--app/models/user_synced_attributes_metadata.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/models/user_synced_attributes_metadata.rb b/app/models/user_synced_attributes_metadata.rb
index 9f374304164..548b99b69d9 100644
--- a/app/models/user_synced_attributes_metadata.rb
+++ b/app/models/user_synced_attributes_metadata.rb
@@ -6,11 +6,11 @@ class UserSyncedAttributesMetadata < ActiveRecord::Base
SYNCABLE_ATTRIBUTES = %i[name email location].freeze
def read_only?(attribute)
- Gitlab.config.omniauth.sync_profile_from_provider && synced?(attribute)
+ sync_profile_from_provider? && synced?(attribute)
end
def read_only_attributes
- return [] unless Gitlab.config.omniauth.sync_profile_from_provider
+ return [] unless sync_profile_from_provider?
SYNCABLE_ATTRIBUTES.select { |key| synced?(key) }
end
@@ -22,4 +22,10 @@ class UserSyncedAttributesMetadata < ActiveRecord::Base
def set_attribute_synced(attribute, value)
write_attribute("#{attribute}_synced", value)
end
+
+ private
+
+ def sync_profile_from_provider?
+ Gitlab::OAuth::Provider.sync_profile_from_provider?(provider)
+ end
end