2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-12-23 00:08:35 +08:00
|
|
|
class WebHookUserSerializer < UserSerializer
|
2018-01-22 07:09:26 +08:00
|
|
|
attributes :external_id
|
|
|
|
|
2016-12-23 00:08:35 +08:00
|
|
|
# remove staff attributes
|
|
|
|
def staff_attributes(*attrs)
|
|
|
|
end
|
2017-03-25 08:20:36 +08:00
|
|
|
|
2018-05-21 11:25:01 +08:00
|
|
|
%i[
|
2020-06-11 00:11:49 +08:00
|
|
|
unconfirmed_emails
|
2018-05-21 11:25:01 +08:00
|
|
|
can_edit
|
|
|
|
can_edit_username
|
|
|
|
can_edit_email
|
|
|
|
can_edit_name
|
|
|
|
can_send_private_messages
|
|
|
|
can_send_private_message_to_user
|
2019-03-27 17:41:50 +08:00
|
|
|
can_ignore_user
|
|
|
|
can_mute_user
|
|
|
|
ignored
|
2018-05-21 11:25:01 +08:00
|
|
|
uploaded_avatar_id
|
|
|
|
has_title_badges
|
|
|
|
bio_cooked
|
|
|
|
custom_fields
|
|
|
|
can_be_deleted
|
|
|
|
can_delete_all_posts
|
|
|
|
system_avatar_upload_id
|
|
|
|
gravatar_avatar_upload_id
|
|
|
|
custom_avatar_upload_id
|
|
|
|
can_change_bio
|
2020-04-28 14:06:35 +08:00
|
|
|
can_change_location
|
|
|
|
can_change_website
|
2021-07-17 02:50:40 +08:00
|
|
|
can_change_tracking_preferences
|
2018-05-21 11:25:01 +08:00
|
|
|
user_api_keys
|
2024-01-24 00:23:26 +08:00
|
|
|
user_passkeys
|
2018-05-21 11:25:01 +08:00
|
|
|
group_users
|
2018-08-31 17:25:56 +08:00
|
|
|
user_auth_tokens
|
|
|
|
user_auth_token_logs
|
2021-04-28 04:28:15 +08:00
|
|
|
use_logo_small_as_avatar
|
2021-08-27 00:16:00 +08:00
|
|
|
pending_posts_count
|
2022-05-27 17:15:14 +08:00
|
|
|
status
|
2023-10-09 07:24:10 +08:00
|
|
|
display_sidebar_tags
|
|
|
|
sidebar_category_ids
|
|
|
|
sidebar_tags
|
2018-05-21 11:25:01 +08:00
|
|
|
].each { |attr| define_method("include_#{attr}?") { false } }
|
|
|
|
|
2017-03-25 08:20:36 +08:00
|
|
|
def include_email?
|
|
|
|
scope.is_admin?
|
|
|
|
end
|
2018-01-22 07:09:26 +08:00
|
|
|
|
2020-06-16 18:00:09 +08:00
|
|
|
alias_method :include_secondary_emails?, :include_email?
|
|
|
|
|
2018-01-22 07:09:26 +08:00
|
|
|
def include_external_id?
|
|
|
|
scope.is_admin? && object.single_sign_on_record
|
|
|
|
end
|
|
|
|
|
|
|
|
def external_id
|
|
|
|
object.single_sign_on_record.external_id
|
|
|
|
end
|
2016-12-23 00:08:35 +08:00
|
|
|
end
|