discourse/app/serializers/admin_detailed_user_serializer.rb

33 lines
714 B
Ruby
Raw Normal View History

2013-02-05 14:16:51 -05:00
class AdminDetailedUserSerializer < AdminUserSerializer
attributes :moderator,
2013-02-07 10:45:24 -05:00
:can_grant_admin,
:can_impersonate,
2013-02-05 14:16:51 -05:00
:can_revoke_admin,
:like_count,
:post_count,
:flags_given_count,
:flags_received_count,
:private_topics_count,
:can_delete_all_posts
2013-02-05 14:16:51 -05: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 10:45:24 -05:00
def can_delete_all_posts
scope.can_delete_all_posts?(object)
end
2013-02-05 14:16:51 -05:00
def moderator
object.has_trust_level?(:moderator)
end
end