pundit: convert pools to pundit.

This commit is contained in:
evazion
2020-03-19 19:31:57 -05:00
parent 83eae1bf11
commit ab5432d149
8 changed files with 58 additions and 59 deletions

View File

@@ -0,0 +1,25 @@
class PoolPolicy < ApplicationPolicy
def gallery?
index?
end
def update?
unbanned? && (!record.is_deleted? || user.is_builder?)
end
def destroy?
!record.is_deleted? && user.is_builder?
end
def undelete?
record.is_deleted? && user.is_builder?
end
def revert?
update?
end
def permitted_attributes
[:name, :description, :category, :post_ids, :post_ids_string, post_ids: []]
end
end