Interface: PermissionGuardOptions<A>
Defined in: packages/astro/src/server.ts:104
The options every guard takes as its last argument: the handlers plus guard. They win over the defaults.
Extends
Type Parameters
| Type Parameter | Default type |
|---|---|
A extends AstroContext | AstroContext |
Properties
| Property | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|
any? | boolean | Pass when the subject has ANY of the permissions (instead of all). Default: false. | - | packages/astro/src/server.ts:106 |
exposeRequirements? | boolean | Include the required roles/permissions in the default 403 body (required). Default: false (like spatie's display_permission_in_exception). | RouteGuardOptions.exposeRequirements | packages/astro/src/server.ts:95 |
forbiddenRedirect? | string | ((context) => string) | Redirect users without access here (302) instead of the 403. | RouteGuardOptions.forbiddenRedirect | packages/astro/src/server.ts:90 |
guard? | string | Check in this guard instead of the server's (subject.withScope({ guard })), like spatie's role:admin,api. | RoleGuardOptions.guard | packages/astro/src/server.ts:101 |
onForbidden? | GuardHandler<A> | Called when the subject lacks access. Wins over forbiddenRedirect. Default: a 403 JSON Response. | RouteGuardOptions.onForbidden | packages/astro/src/server.ts:83 |
onUnauthenticated? | GuardHandler<A> | Called when there is no subject. Wins over unauthenticatedRedirect. Default: a 401 JSON Response. | RouteGuardOptions.onUnauthenticated | packages/astro/src/server.ts:81 |
unauthenticatedRedirect? | string | ((context) => string) | Redirect guests here (302) instead of the 401. Handy for pages: '/login'. A function gets the context, e.g. to keep the page: ({ url }) => /login?redirectTo=${url.pathname}``. | RouteGuardOptions.unauthenticatedRedirect | packages/astro/src/server.ts:88 |
