Skip to content
Snippets Groups Projects
Commit ff2b7a2f authored by Douglas AC's avatar Douglas AC
Browse files

Rendering attribute "times_blocked" only if the requester is the own user, an...

Rendering attribute "times_blocked" only if the requester is the own user, an editor or en administrator.
parent ac296a0c
No related branches found
No related tags found
No related merge requests found
......@@ -62,7 +62,7 @@ class UserSerializer < ActiveModel::Serializer
end
def is_current_user?
(!current_user.nil?)&&(object.id == current_user.id || current_user.is_admin? || current_user.roles.exists?(Role.find_by_name('editor').id))
(!current_user.nil?)&&(object.id == current_user.id || current_user.can_edit?)
end
attributes \
......@@ -93,6 +93,9 @@ class UserSerializer < ActiveModel::Serializer
:terms_accepted_at,
:state
attribute \
:times_blocked, if: :is_current_user?
belongs_to :school
has_many :subjects
has_many :roles
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment