Our domain of "admin?" method names is already a bit confounding. The policy methods renamed the existing Policy::Authorizer methods, and further obfuscated and confused intention. This refactor aligns the policy methods with the Policy::Authorizer methods. It is a non-breaking change, but one that may add warnings in the logs. If you see those, resolve them per instructions. Related to #16483
21 lines
361 B
Ruby
21 lines
361 B
Ruby
class HtmlVariantPolicy < ApplicationPolicy
|
|
def index?
|
|
user_any_admin?
|
|
end
|
|
|
|
alias show? minimal_admin?
|
|
|
|
alias edit? minimal_admin?
|
|
|
|
alias update? minimal_admin?
|
|
|
|
alias new? minimal_admin?
|
|
|
|
alias create? minimal_admin?
|
|
|
|
alias destroy? minimal_admin?
|
|
|
|
def permitted_attributes
|
|
%i[html name published approved target_tag group]
|
|
end
|
|
end
|