a simple comment policy
This commit is contained in:
21
app/policies/quiz_comment_policy.rb
Normal file
21
app/policies/quiz_comment_policy.rb
Normal file
@ -0,0 +1,21 @@
|
||||
# frozen_string_literal: true
|
||||
class QuizCommentPolicy < ApplicationPolicy
|
||||
# Quiz Comment Policy
|
||||
#
|
||||
# Anyone with access to the results can comment
|
||||
# Only Comment owner can edit
|
||||
|
||||
def create?
|
||||
user.acts_as_reviewer?
|
||||
end
|
||||
|
||||
def update?
|
||||
user.acts_as_reviewer? && user.id == record.user_id
|
||||
end
|
||||
|
||||
class Scope < Scope
|
||||
def resolve
|
||||
true
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user