Skip to content

Interface: RbacModuleConfig<T> ​

Defined in: packages/nestjs/src/options.ts:37

T is the engine's names type (createRbac<AppRbac>()), inferred from rbac. Nest's parameter decorators can't carry it to @CurrentRbac(): type the parameter as SubjectRbac<AppRbac> (see createRbacDecorators).

Extends ​

Type Parameters ​

Type ParameterDefault type
T extends RbacTypeConfigDefaultRbacTypes

Properties ​

PropertyTypeDescriptionInherited fromDefined in
exposeRequirements?booleanInclude the required roles/permissions in the 403 body (required). Default: false (like spatie's display_permission_in_exception).RbacModuleOptions.exposeRequirementspackages/nestjs/src/options.ts:26
getSubject(context) => MaybePromise<Subject | null | undefined>Resolves the authenticated subject for this execution context (e.g. from request.user). Return null / undefined for guests.RbacModuleOptions.getSubjectpackages/nestjs/src/options.ts:17
globalGuard?booleanRegister RbacGuard as a global guard (APP_GUARD), so every route resolves the subject (and @CurrentRbac() works without a @Require* decorator). Default: false.GlobalGuardOption.globalGuardpackages/nestjs/src/options.ts:34
guard?stringRBAC guard name (e.g. web or api) — not a Nest guard. Defaults to the engine's defaultGuard.RbacModuleOptions.guardpackages/nestjs/src/options.ts:19
rbacRbac<T>The RBAC engine created with createRbac(...).RbacModuleOptions.rbacpackages/nestjs/src/options.ts:12
team?(context) => MaybePromise<TeamId | undefined>Resolves the current team (only when the engine was created with teams: true).RbacModuleOptions.teampackages/nestjs/src/options.ts:21

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