Class: UserSyncedAttributesMetadata
Constant Summary
collapse
- SYNCABLE_ATTRIBUTES =
%i[name email location].freeze
ApplicationRecord::MAX_PLUCK
ResetOnUnionError::MAX_RESET_PERIOD
Class Method Summary
collapse
Instance Method Summary
collapse
cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
#serializable_hash
Class Method Details
.ldap_provider?(provider) ⇒ Boolean
.ldap_sync_name?(provider) ⇒ Boolean
48
49
50
51
52
53
|
# File 'app/models/user_synced_attributes_metadata.rb', line 48
def ldap_sync_name?(provider)
return false unless provider
config = Gitlab::Auth::Ldap::Config.new(provider)
config.enabled? && config.sync_name
end
|
.syncable_attributes(provider = nil) ⇒ Object
Instance Method Details
#read_only?(attribute) ⇒ Boolean
10
11
12
|
# File 'app/models/user_synced_attributes_metadata.rb', line 10
def read_only?(attribute)
sync_profile_from_provider? && synced?(attribute)
end
|
#read_only_attributes ⇒ Object
14
15
16
17
18
|
# File 'app/models/user_synced_attributes_metadata.rb', line 14
def read_only_attributes
return [] unless sync_profile_from_provider?
SYNCABLE_ATTRIBUTES.select { |key| synced?(key) }
end
|
#set_attribute_synced(attribute, value) ⇒ Object
24
25
26
|
# File 'app/models/user_synced_attributes_metadata.rb', line 24
def set_attribute_synced(attribute, value)
write_attribute("#{attribute}_synced", value)
end
|
#synced?(attribute) ⇒ Boolean
20
21
22
|
# File 'app/models/user_synced_attributes_metadata.rb', line 20
def synced?(attribute)
read_attribute("#{attribute}_synced")
end
|