2013-02-05 13:16:51 -06:00
|
|
|
class AdminDetailedUserSerializer < AdminUserSerializer
|
|
|
|
|
|
|
|
attributes :moderator,
|
2013-02-07 09:45:24 -06:00
|
|
|
:can_grant_admin,
|
2013-02-05 13:16:51 -06:00
|
|
|
:can_revoke_admin,
|
2013-02-12 16:58:08 -06:00
|
|
|
:can_grant_moderation,
|
|
|
|
:can_revoke_moderation,
|
|
|
|
:can_impersonate,
|
2013-02-05 13:16:51 -06:00
|
|
|
:like_count,
|
|
|
|
:post_count,
|
2013-07-26 14:40:08 -05:00
|
|
|
:topic_count,
|
2013-02-05 13:16:51 -06:00
|
|
|
:flags_given_count,
|
|
|
|
:flags_received_count,
|
2013-02-07 01:11:56 -06:00
|
|
|
:private_topics_count,
|
2013-07-26 14:40:08 -05:00
|
|
|
:can_delete_all_posts,
|
2013-11-01 09:47:03 -05:00
|
|
|
:can_be_deleted,
|
2013-11-07 12:53:32 -06:00
|
|
|
:suspend_reason
|
2013-02-05 13:16:51 -06:00
|
|
|
|
|
|
|
has_one :approved_by, serializer: BasicUserSerializer, embed: :objects
|
2013-10-22 14:53:08 -05:00
|
|
|
has_one :api_key, serializer: ApiKeySerializer, embed: :objects
|
2013-11-07 12:53:32 -06:00
|
|
|
has_one :suspended_by, serializer: BasicUserSerializer, embed: :objects
|
2013-02-05 13:16:51 -06:00
|
|
|
|
|
|
|
def can_revoke_admin
|
|
|
|
scope.can_revoke_admin?(object)
|
|
|
|
end
|
|
|
|
|
|
|
|
def can_grant_admin
|
|
|
|
scope.can_grant_admin?(object)
|
|
|
|
end
|
2013-02-07 09:45:24 -06:00
|
|
|
|
2013-02-12 16:58:08 -06:00
|
|
|
def can_revoke_moderation
|
|
|
|
scope.can_revoke_moderation?(object)
|
|
|
|
end
|
|
|
|
|
|
|
|
def can_grant_moderation
|
|
|
|
scope.can_grant_moderation?(object)
|
|
|
|
end
|
|
|
|
|
2013-02-07 01:11:56 -06:00
|
|
|
def can_delete_all_posts
|
|
|
|
scope.can_delete_all_posts?(object)
|
|
|
|
end
|
2013-02-05 13:16:51 -06:00
|
|
|
|
2013-07-26 14:40:08 -05:00
|
|
|
def can_be_deleted
|
|
|
|
scope.can_delete_user?(object)
|
|
|
|
end
|
|
|
|
|
2013-02-05 13:16:51 -06:00
|
|
|
def moderator
|
2013-03-19 23:05:19 -05:00
|
|
|
object.moderator
|
2013-02-05 13:16:51 -06:00
|
|
|
end
|
|
|
|
|
2013-07-26 14:40:08 -05:00
|
|
|
def topic_count
|
|
|
|
object.topics.count
|
|
|
|
end
|
|
|
|
|
2013-10-22 14:53:08 -05:00
|
|
|
def include_api_key?
|
|
|
|
api_key.present?
|
|
|
|
end
|
|
|
|
|
2013-11-07 12:53:32 -06:00
|
|
|
def suspended_by
|
|
|
|
object.suspend_record.try(:acting_user)
|
2013-11-01 09:47:03 -05:00
|
|
|
end
|
|
|
|
|
2013-02-05 13:16:51 -06:00
|
|
|
end
|