pundit: convert post disapprovals to pundit.

This commit is contained in:
evazion
2020-03-19 20:10:48 -05:00
parent 84c654464d
commit ba0a5dda8a
5 changed files with 42 additions and 32 deletions

View File

@@ -0,0 +1,13 @@
class PostDisapprovalPolicy < ApplicationPolicy
def create?
user.is_approver?
end
def can_view_creator?
user.is_moderator? || record.user_id == user.id
end
def permitted_attributes
[:post_id, :reason, :message]
end
end