Interface: CreateGuardsOptions<R>
Defined in: packages/trpc/src/guards.ts:81
The options of createGuards(): the shared handlers, plus a resolve that replaces ctx.rbac.
Extends
Type Parameters
| Type Parameter | Default type |
|---|---|
R | SubjectRbac |
Properties
| Property | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|
exposeRequirements? | boolean | Include the required roles/permissions in the default error (required in its body). Default: false (like spatie's display_permission_in_exception). | GuardHandlers.exposeRequirements | packages/trpc/src/guards.ts:71 |
onForbidden? | GuardHandler<R> | Called when the subject lacks access. Default: a TRPCError FORBIDDEN. | GuardHandlers.onForbidden | packages/trpc/src/guards.ts:66 |
onUnauthenticated? | GuardHandler<R> | Called when there is no subject (ctx.rbac is null). Default: a TRPCError UNAUTHORIZED. | GuardHandlers.onUnauthenticated | packages/trpc/src/guards.ts:64 |
resolve? | RbacResolver<R> | Reads the subject of each call. Default: ctx.rbac, as createRbacContext() sets it. With resolve, the procedures don't need rbac in their context. It runs once per guard and call. | - | packages/trpc/src/guards.ts:86 |
