pundit: convert favorite groups to pundit.

This commit is contained in:
evazion
2020-03-19 18:12:16 -05:00
parent 50fa674a3e
commit 2c4c29b81a
9 changed files with 80 additions and 54 deletions

View File

@@ -0,0 +1,21 @@
class FavoriteGroupPolicy < ApplicationPolicy
def show?
record.creator_id == user.id || record.is_public
end
def create?
user.is_member?
end
def update?
record.creator_id == user.id
end
def add_post?
update?
end
def permitted_attributes
[:name, :post_ids_string, :is_public, :post_ids, post_ids: []]
end
end