usePermissions API
API reference for the usePermissions composable.
Related
Explore these related pages for additional context and usage patterns.
| Page | Category |
|---|---|
| usePermissions | Plugins |
| useFeatures | Plugins |
| createTokens | Registration |
Functions
createPermissions
(_options?: PermissionOptions) => PermissionContext<PermissionTicket>Creates a new permissions instance.
createPermissionsContext
<_E>(_options?: PermissionContextOptions | undefined) => ContextTrinity<_E>createPermissionsPlugin
(_options?: PermissionContextOptions | undefined) => PluginusePermissions
<_E>(namespace?: string) => _EOptions
adapter
PermissionsAdapter | undefinedpermissions
Record<ID, [string | string[], string | string[], (boolean | ((context: Record<string, unknown>) => boolean) | undefined)?][]> | undefinedProperties
Methods
seek
(direction?: "first" | "last", from?: number, predicate?: (ticket) => boolean) => E | undefinedSeek for a ticket based on direction and optional predicate
on
<K extends Extensible<RegistryEventName>>(event: K, cb: RegistryEventCallback<E, K>) => voidListen for registry events
off
<K extends Extensible<RegistryEventName>>(event: K, cb: RegistryEventCallback<E, K>) => voidStop listening for registry events
emit
<K extends Extensible<RegistryEventName>>(event: K, data: EventPayload<E, K>) => voidEmit an event with data
offboard
(ids: ID[]) => Partial<Z>[]Offboard multiple tickets at once, returning the input shapes that were removed.
batch
<R>(fn: () => R) => RExecute operations in a batch, deferring cache invalidation and event emission until complete
can
(id: ID, action: string, subject: string, context?: Record<string, unknown>) => boolean