2013-02-06 03:16:51 +08:00
|
|
|
class AdminDetailedUserSerializer < AdminUserSerializer
|
|
|
|
|
|
|
|
attributes :moderator,
|
2013-02-07 23:45:24 +08:00
|
|
|
:can_grant_admin,
|
2013-02-06 03:16:51 +08:00
|
|
|
:can_revoke_admin,
|
2013-02-13 06:58:08 +08:00
|
|
|
:can_grant_moderation,
|
|
|
|
:can_revoke_moderation,
|
|
|
|
:can_impersonate,
|
2013-02-06 03:16:51 +08:00
|
|
|
:like_count,
|
|
|
|
:post_count,
|
|
|
|
:flags_given_count,
|
|
|
|
:flags_received_count,
|
2013-02-07 15:11:56 +08:00
|
|
|
:private_topics_count,
|
|
|
|
:can_delete_all_posts
|
2013-02-06 03:16:51 +08:00
|
|
|
|
|
|
|
has_one :approved_by, serializer: BasicUserSerializer, embed: :objects
|
|
|
|
|
|
|
|
def can_revoke_admin
|
|
|
|
scope.can_revoke_admin?(object)
|
|
|
|
end
|
|
|
|
|
|
|
|
def can_grant_admin
|
|
|
|
scope.can_grant_admin?(object)
|
|
|
|
end
|
2013-02-07 23:45:24 +08:00
|
|
|
|
2013-02-13 06:58:08 +08:00
|
|
|
def can_revoke_moderation
|
|
|
|
scope.can_revoke_moderation?(object)
|
|
|
|
end
|
|
|
|
|
|
|
|
def can_grant_moderation
|
|
|
|
scope.can_grant_moderation?(object)
|
|
|
|
end
|
|
|
|
|
2013-02-07 15:11:56 +08:00
|
|
|
def can_delete_all_posts
|
|
|
|
scope.can_delete_all_posts?(object)
|
|
|
|
end
|
2013-02-06 03:16:51 +08:00
|
|
|
|
|
|
|
def moderator
|
2013-03-20 12:05:19 +08:00
|
|
|
object.moderator
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|