Skip to content

Type Alias: RbacResolver<R> ​

ts
type RbacResolver<R> = (opts) => MaybePromise<R | null | undefined>;

Defined in: packages/trpc/src/guards.ts:78

Reads the subject of a call, instead of ctx.rbac: ({ ctx }) => (ctx.user ? rbac.for(ctx.user) : null). Return null / undefined for guests.

Type Parameters ​

Type ParameterDefault type
RSubjectRbac

Parameters ​

ParameterType
optsGuardCallOptions

Returns ​

MaybePromise<R | null | undefined>

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