Skip to content

Type Alias: RbacRequest<T, Req, G> ​

ts
type RbacRequest<T, Req, G> = Omit<Req, "rbac"> & object;

Defined in: packages/fastify/src/plugin.ts:49

A Fastify request whose rbac has the names of T (a names type like AppRbac, or typeof rbac). With per-guard names, G is the guard of the request (the default guard's names by default): RbacRequest<typeof rbac, FastifyRequest, 'api'> on the routes of an api middleware. For typing a handler without a global RbacRegister, e.g. when two plugins use different engines:

ts
app.get('/articles', async (request: RbacRequest<typeof rbac>) => { ... })

Type Parameters ​

Type ParameterDefault type
T extends RbacTypeConfig | Rbac<RbacTypeConfig>DefaultRbacTypes
ReqFastifyRequest
G extends stringDefaultGuardName<TypesOf<T>>

Type Declaration ​

NameTypeDescriptionDefined in
rbac?| SubjectRbac<TypesOf<T>, ScopedGuardName<TypesOf<T>, G>> | nullRoles & permissions of the current subject, set by the rbac-evolution plugin. null for guests, undefined when the plugin did not run for this request.packages/fastify/src/plugin.ts:58

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