skill-assessment-app/app/policies/quiz_comment_policy.rb
2017-02-14 10:17:42 -06:00

20 lines
433 B
Ruby

# frozen_string_literal: true
class QuizCommentPolicy < ApplicationPolicy
# Quiz Comment Policy
#
# 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? && record.candidate.reviewers.where(id: user.id).count.positive?
end
def update?
user.acts_as_reviewer? && user.id == record.user_id
end
end