Interface: RoleGuardOptions<C>
Defined in: packages/elysia/src/guards.ts:73
The options every guard takes: the handlers plus guard (check in another guard, like spatie's role:admin,api).
Extends
Type Parameters
| Type Parameter | Default type |
|---|---|
C | GuardHandlerContext |
Properties
| Property | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|
all? | boolean | Require ALL of the roles (instead of any). Default: false. | - | packages/elysia/src/guards.ts:75 |
exposeRequirements? | boolean | Include the required roles/permissions in the default 403 body. Default: false (like spatie's display_permission_in_exception). | RouteGuardOptions.exposeRequirements | packages/elysia/src/guards.ts:59 |
guard? | string | Check in this guard instead of the request's (subject.withScope({ guard })). Default: the request's guard. | RouteGuardOptions.guard | packages/elysia/src/guards.ts:65 |
onForbidden? | GuardHandler<C> | Called when the subject lacks access. Default: 403 JSON. | RouteGuardOptions.onForbidden | packages/elysia/src/guards.ts:54 |
onUnauthenticated? | GuardHandler<C> | Called when there is no subject (rbac is null). Default: 401 JSON. | RouteGuardOptions.onUnauthenticated | packages/elysia/src/guards.ts:52 |
