rosa-build/app/policies/comment_policy.rb

15 lines
331 B
Ruby

class CommentPolicy < ApplicationPolicy
def create?
!user.guest? && ProjectPolicy.new(user, record.project).show?
end
alias_method :new_line?, :create?
def update?
return false if user.guest?
is_admin? || record.user_id == user.id || local_admin?(record.project)
end
alias_method :destroy?, :update?
end