Marks a method of a @Policy class as an ability.
@Policy
The method receives (principal, target) and allows only by returning true (or a promise of true); any other value, a throw, or a rejection denies. A method named before is the policy's before hook, not an ability, and is refused if marked.
(principal, target)
true
before
Optional
Whether the ability is evaluated for anonymous principals
A standard method decorator
0.9.0
Marks a method of a
@Policyclass as an ability.The method receives
(principal, target)and allows only by returningtrue(or a promise oftrue); any other value, a throw, or a rejection denies. A method namedbeforeis the policy'sbeforehook, not an ability, and is refused if marked.