Type Alias: RbacRequest<T, Req, G>
ts
type RbacRequest<T, Req, G> = Omit<Req, "rbac"> & object;Defined in: packages/express/src/middleware.ts:48
An Express 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, Request, 'api'> on the routes of an api middleware. For typing a handler without a global RbacRegister, e.g. when two routers use different engines:
ts
app.get('/articles', (req: RbacRequest<typeof rbac>, res) => { ... })Type Parameters
| Type Parameter | Default type |
|---|---|
T extends RbacTypeConfig | Rbac<RbacTypeConfig> | DefaultRbacTypes |
Req | Request |
G extends string | DefaultGuardName<TypesOf<T>> |
Type Declaration
| Name | Type | Description | Defined in |
|---|---|---|---|
rbac? | | SubjectRbac<TypesOf<T>, ScopedGuardName<TypesOf<T>, G>> | null | Roles & permissions of the current subject, set by rbacMiddleware(). null for guests, undefined when the middleware did not run. | packages/express/src/middleware.ts:57 |
