Function: getRbac()
ts
function getRbac<T, G>(context):
| SubjectRbac<TypesOf<T>, ScopedGuardName<TypesOf<T>, G>>
| null;Defined in: packages/nestjs/src/context.ts:71
Returns the SubjectRbac that RbacGuard resolved for this execution context (null for guests). Throws RbacGuardMissingError when the guard has not run.
getRbac<AppRbac>(context) (or getRbac<typeof rbac>(context)) types it with the engine's names. With per-guard names, getRbac<AppRbac, 'api'>(context) types it with the names of guard api (the guard of RbacModule); the default guard's names without it.
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends RbacTypeConfig | Rbac<RbacTypeConfig> | DefaultRbacTypes |
G extends string | DefaultGuardName<TypesOf<T>> |
Parameters
| Parameter | Type |
|---|---|
context | ExecutionContext |
Returns
| SubjectRbac<TypesOf<T>, ScopedGuardName<TypesOf<T>, G>> | null
