mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: add site setting to include user associated account ids. (#18375)
By default, we won't include associated account ids in current user serializer. If the new hidden site setting `include_associated_account_ids` is enabled then we will add it in the serializer.
This commit is contained in:
@@ -58,6 +58,7 @@ class CurrentUserSerializer < BasicUserSerializer
|
||||
:can_create_group,
|
||||
:link_posting_access,
|
||||
:external_id,
|
||||
:associated_account_ids,
|
||||
:top_category_ids,
|
||||
:hide_profile_and_presence,
|
||||
:groups,
|
||||
@@ -293,6 +294,20 @@ class CurrentUserSerializer < BasicUserSerializer
|
||||
SiteSetting.enable_discourse_connect
|
||||
end
|
||||
|
||||
def associated_account_ids
|
||||
values = {}
|
||||
|
||||
object.user_associated_accounts.map do |user_associated_account|
|
||||
values[user_associated_account.provider_name] = user_associated_account.provider_uid
|
||||
end
|
||||
|
||||
values
|
||||
end
|
||||
|
||||
def include_associated_account_ids?
|
||||
SiteSetting.include_associated_account_ids
|
||||
end
|
||||
|
||||
def second_factor_enabled
|
||||
object.totp_enabled? || object.security_keys_enabled?
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user