Files
danbooru/app/policies/artist_policy.rb
2020-03-20 18:03:00 -05:00

22 lines
435 B
Ruby

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