Function: useCan()
useCan(
subject,capability):boolean
Defined in: src/core/services/access.service.ts:130
Whether the subject may perform a capability. Any of the subject's roles granting the capability (directly or by inheritance) is enough.
Parameters
subject
capability
Returns
boolean
Example
useCan({ id: 1, roles: ["author"] }, "content:publish"); // false
useCan({ id: 1, roles: ["author"] }, "content:create"); // true
useCan({ id: 2, roles: ["editor"] }, "content:create"); // true (inherits author)
useCan({ id: 3, roles: [] }, "conversations:use"); // false