Type Alias: RbacContext<T, G>
ts
type RbacContext<T, G> = object;Defined in: packages/trpc/src/context.ts:36
The part of the tRPC context this package reads and writes: ctx.rbac, a SubjectRbac for the current subject or null for guests. Spread it into what createContext returns (see createRbacContext()), or type your context with it: type Context = RbacContext<typeof rbac> & { user: User | null }.
T (a names type like AppRbac, or typeof rbac) types the names ctx.rbac accepts; without it, any name. With per-guard names, G is the guard of the subject: the default guard's names by default.
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends RbacTypeConfig | Rbac<RbacTypeConfig> | DefaultRbacTypes |
G extends string | DefaultGuardName<TypesOf<T>> |
Properties
rbac
ts
rbac: GuardSubject<T, G> | null;Defined in: packages/trpc/src/context.ts:41
Roles & permissions of the current subject. null for guests.
