comment policy and test updates

This commit is contained in:
Mark Moser
2017-02-14 10:17:42 -06:00
parent 906b62247b
commit a8c42af3de
5 changed files with 64 additions and 19 deletions

View File

@ -2,20 +2,18 @@
class QuizCommentPolicy < ApplicationPolicy
# Quiz Comment Policy
#
# Anyone with access to the results can comment
# Only Comment owner can edit
# Anyone who can vote on results, can comment
# Only comment owner can edit her comment
def new?
user.acts_as_reviewer?
end
def create?
user.acts_as_reviewer?
user.acts_as_reviewer? && record.candidate.reviewers.where(id: user.id).count.positive?
end
def update?
user.acts_as_reviewer? && user.id == record.user_id
end
class Scope < Scope
def resolve
true
end
end
end