The constructor of the base policy class. This can be called with super(user, record) and this.setup.apply(this) to initialise the policy with the specified actions (methods) that are defined by the class that extends Policy.
The user being authorised by a policy action.
The record/object being authorised by a policy action.
A map of policy action names and corresponding functions/methods that can be used to permit or forbid actions of the user for the record.
A kind of "model" object, whose authorisation you want to check.
The user you want to authorise (such the current user of the app).
An optional helper method that can be used to manually add a function as an action to the policy at runtime. Not needed if this.setup.apply(this) is used in the class constructor.
The intended name of the action to add to the policy.
The intended function to authorise the action.
Returns a boolean depending on whether the user is authorised to perform the specified action.
The name of the policy action being authorised.
An optional helper method to make a copy of the policy with the same user, record, and actions.
Override the existing user property of the policy
Override the existing record property of the policy.
A base class for creating Pundit.js policies. Policy classes can extend from this class (recommended) or set up actions at runtime for an instance of this class.