Files
danbooru/app/policies/artist_policy.rb
evazion a7dc05ce63 Enable frozen string literals.
Make all string literals immutable by default.
2021-12-14 21:33:27 -06:00

28 lines
480 B
Ruby

# frozen_string_literal: true
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 can_view_banned?
!user.is_anonymous?
end
def permitted_attributes
[:name, :other_names, :other_names_string, :group_name, :url_string, :is_deleted]
end
def permitted_attributes_for_new
permitted_attributes + [:source]
end
end