Files
danbooru/app/policies/artist_policy.rb
evazion 7a819b0060 artists: hide banned artist pages from anonymous users.
Hide banned artist pages from anonymous (logged out) users. Partial
revert of 6b066f2ca. Artists sometimes ask us to remove all their
information from the site, including their artist profile. It's easier
to hide their profile than to explain to Japanese artists that a) we're
under no obligation to remove their profile and b) we need to keep it to
maintain the ban on their content that they asked for.
2020-05-29 11:27:59 -05:00

26 lines
445 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 can_view_banned?
user.is_member?
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