Skip to content

Interface: NuxtRbac ​

Defined in: packages/nuxt/src/runtime/types.ts:16

The RBAC instance provided as $rbac / returned by useRbac().

Extends ​

  • VueRbac

Properties ​

PropertyModifierTypeDescriptionInherited fromDefined in
loadingreadonlyReadonly<Ref<boolean>>true until the first setSnapshot() when created with loading: true (reactive).VueRbac.loadingpackages/vue/dist/index.d.ts:34
snapshotreadonlyReadonly<Ref<DeepReadonly<RbacSnapshot>>>Current snapshot (read-only, reactive).VueRbac.snapshotpackages/vue/dist/index.d.ts:32

Methods ​

can() ​

ts
can(permission): boolean;

Defined in: packages/vue/dist/index.d.ts:38

true if the user has the permission (or, for a list, ALL of them).

Parameters ​

ParameterType
permissionNameList

Returns ​

boolean

Inherited from ​

VueRbac.can


canAll() ​

ts
canAll(permissions): boolean;

Defined in: packages/vue/dist/index.d.ts:41

Parameters ​

ParameterType
permissionsNameList

Returns ​

boolean

Inherited from ​

VueRbac.canAll


canAny() ​

ts
canAny(permissions): boolean;

Defined in: packages/vue/dist/index.d.ts:40

Parameters ​

ParameterType
permissionsNameList

Returns ​

boolean

Inherited from ​

VueRbac.canAny


cannot() ​

ts
cannot(permission): boolean;

Defined in: packages/vue/dist/index.d.ts:39

Parameters ​

ParameterType
permissionNameList

Returns ​

boolean

Inherited from ​

VueRbac.cannot


hasAllRoles() ​

ts
hasAllRoles(roles): boolean;

Defined in: packages/vue/dist/index.d.ts:45

Parameters ​

ParameterType
rolesNameList

Returns ​

boolean

Inherited from ​

VueRbac.hasAllRoles


hasAnyRole() ​

ts
hasAnyRole(roles): boolean;

Defined in: packages/vue/dist/index.d.ts:44

Parameters ​

ParameterType
rolesNameList

Returns ​

boolean

Inherited from ​

VueRbac.hasAnyRole


hasRole() ​

ts
hasRole(roles): boolean;

Defined in: packages/vue/dist/index.d.ts:43

true if the user has the role, or ANY of the roles. Supports 'writer|editor'.

Parameters ​

ParameterType
rolesNameList

Returns ​

boolean

Inherited from ​

VueRbac.hasRole


isGuest() ​

ts
isGuest(): boolean;

Defined in: packages/nuxt/src/runtime/types.ts:20

true when there is no subject (the server resolved a guest, or setSnapshot(null)).

Returns ​

boolean


isSuperAdmin() ​

ts
isSuperAdmin(): boolean;

Defined in: packages/vue/dist/index.d.ts:47

true if the user has one of the configured superAdminRoles.

Returns ​

boolean

Inherited from ​

VueRbac.isSuperAdmin


setSnapshot() ​

ts
setSnapshot(snapshot): void;

Defined in: packages/nuxt/src/runtime/types.ts:18

Replaces the snapshot (and the SSR state), e.g. after login (snapshot) or logout (null).

Parameters ​

ParameterType
snapshotRbacSnapshot | null

Returns ​

void

Overrides ​

VueRbac.setSnapshot

Released under the MIT License. Inspired by spatie/laravel-permission.