pundit: convert artists to pundit.

This commit is contained in:
evazion
2020-03-17 20:22:26 -05:00
parent 79a365abe0
commit ff1d71af2e
5 changed files with 155 additions and 130 deletions

View File

@@ -0,0 +1,21 @@
class ArtistPolicy < ApplicationPolicy
def ban?
user.is_admin? && !record.is_banned?
end
def unban?
user.is_admin? && record.is_banned?
end
def revert?
unbanned?
end
def permitted_attributes
[:name, :other_names, :other_names_string, :group_name, :url_string, :is_deleted, { wiki_page_attributes: [:id, :body] }]
end
def permitted_attributes_for_new
permitted_attributes + [:source]
end
end