Skip to content

Interface: RbacServerOptions<T, G> ​

Defined in: packages/tanstack-start/src/server.ts:164

Extends ​

Type Parameters ​

Type ParameterDefault type
T extends RbacTypeConfigDefaultRbacTypes
G extends stringDefaultGuardName<T>

Properties ​

PropertyTypeDescriptionInherited fromDefined in
exposeRequirements?booleanInclude the required roles/permissions in the default 403 body (required). Default: false (like spatie's display_permission_in_exception).GuardHandlers.exposeRequirementspackages/tanstack-start/src/server.ts:71
getSubject(request) => MaybePromise<Subject | null | undefined>Resolves the authenticated subject of the request (a session cookie, a JWT, your auth library's session...). Return null / undefined for guests.-packages/tanstack-start/src/server.ts:174
guard?GGuard name (e.g. web or api). Defaults to the engine's defaultGuard.-packages/tanstack-start/src/server.ts:176
onForbidden?GuardHandlerCalled when the subject lacks access. Default: a 403 JSON Response.GuardHandlers.onForbiddenpackages/tanstack-start/src/server.ts:66
onUnauthenticated?GuardHandlerCalled 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.GuardHandlers.onUnauthenticatedpackages/tanstack-start/src/server.ts:64
rbacRbac<T>The RBAC engine created with createRbac(...). Its typed names flow into the guards.-packages/tanstack-start/src/server.ts:169
team?(request) => MaybePromise<TeamId | undefined>Resolves the current team (only when the engine was created with teams: true).-packages/tanstack-start/src/server.ts:178

Released under the MIT License. Inspired by spatie/laravel-permission.