31 lines
376 B
Ruby
31 lines
376 B
Ruby
class RequestForCommentPolicy < ApplicationPolicy
|
|
def author?
|
|
@user == @record.author
|
|
end
|
|
private :author?
|
|
|
|
def create?
|
|
everyone
|
|
end
|
|
|
|
def show?
|
|
everyone
|
|
end
|
|
|
|
[:destroy?].each do |action|
|
|
define_method(action) { admin? }
|
|
end
|
|
|
|
def mark_as_solved?
|
|
admin? || author?
|
|
end
|
|
|
|
def edit?
|
|
admin?
|
|
end
|
|
|
|
def index?
|
|
everyone
|
|
end
|
|
end
|