Create a subclass which represents the connection between the resource type (db model) and a given role. Use the member and record attrs, along with the site_administration_role method to determine if the current member has permission to perform the action.
Subclasses must implement the site method, which may just be a delegate to the record in most cases.
Best practice is to match the controller action for the permission name, however this is not enforced and sometimes not possible.
def show?
@record.active? && site_admin?
end
Return a Truthy/Falsy object
Namespace
- CLASS ApplicationPermission