2019-05-02 17:17:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-12-22 10:08:35 -06:00
|
|
|
class WebHookUserSerializer < UserSerializer
|
2018-01-21 17:09:26 -06:00
|
|
|
attributes :external_id
|
|
|
|
|
2016-12-22 10:08:35 -06:00
|
|
|
# remove staff attributes
|
|
|
|
def staff_attributes(*attrs)
|
|
|
|
end
|
2017-03-24 19:20:36 -05:00
|
|
|
|
2018-05-20 22:25:01 -05:00
|
|
|
%i{
|
|
|
|
can_edit
|
|
|
|
can_edit_username
|
|
|
|
can_edit_email
|
|
|
|
can_edit_name
|
|
|
|
can_send_private_messages
|
|
|
|
can_send_private_message_to_user
|
2019-03-27 04:41:50 -05:00
|
|
|
can_ignore_user
|
|
|
|
can_mute_user
|
|
|
|
ignored
|
2018-05-20 22:25:01 -05: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 01:06:35 -05:00
|
|
|
can_change_location
|
|
|
|
can_change_website
|
2018-05-20 22:25:01 -05:00
|
|
|
user_api_keys
|
|
|
|
group_users
|
2018-08-31 04:25:56 -05:00
|
|
|
user_auth_tokens
|
|
|
|
user_auth_token_logs
|
2018-05-20 22:25:01 -05:00
|
|
|
}.each do |attr|
|
|
|
|
define_method("include_#{attr}?") do
|
|
|
|
false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-03-24 19:20:36 -05:00
|
|
|
def include_email?
|
|
|
|
scope.is_admin?
|
|
|
|
end
|
2018-01-21 17:09:26 -06: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-22 10:08:35 -06:00
|
|
|
end
|