Interface: PermissionGuardOptions
Defined in: packages/tanstack-start/src/server.ts:80
The options every guard takes as its last argument: the handlers plus guard. They win over the defaults.
Extends
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/tanstack-start/src/server.ts:82 |
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/tanstack-start/src/server.ts:71 |
guard? | string | Check in this guard instead of the server's (subject.withScope({ guard })), like spatie's role:admin,api. | RouteGuardOptions.guard | packages/tanstack-start/src/server.ts:77 |
onForbidden? | GuardHandler | Called when the subject lacks access. Default: a 403 JSON Response. | RouteGuardOptions.onForbidden | packages/tanstack-start/src/server.ts:66 |
onUnauthenticated? | GuardHandler | Called when there is no subject. Default: a 401 JSON Response. For a page, return TanStack Router's redirect({ to: '/login' }): a plain 302 Response from a server function is followed by fetch, not the router. | RouteGuardOptions.onUnauthenticated | packages/tanstack-start/src/server.ts:64 |
