mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
28 lines
606 B
Ruby
28 lines
606 B
Ruby
|
class AdminDetailedUserSerializer < AdminUserSerializer
|
||
|
|
||
|
attributes :moderator,
|
||
|
:can_grant_admin,
|
||
|
:can_impersonate,
|
||
|
:can_revoke_admin,
|
||
|
:like_count,
|
||
|
:post_count,
|
||
|
:flags_given_count,
|
||
|
:flags_received_count,
|
||
|
:private_topics_count
|
||
|
|
||
|
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
|
||
|
|
||
|
def moderator
|
||
|
object.has_trust_level?(:moderator)
|
||
|
end
|
||
|
|
||
|
end
|