Interface: RbacOptions<T>
Defined in: packages/core/src/rbac.ts:97
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends RbacTypeConfig | DefaultRbacTypes |
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
adapter | RbacAdapter | Storage adapter (e.g. new MemoryAdapter(), Prisma, Drizzle, ...). | packages/core/src/rbac.ts:99 |
before? | BeforeHook<T> | Runs before every can() / cannot() / canAny() / canAll() check (spatie's Gate::before). Return true to allow, false to deny, undefined to fall through to the normal check. Not applied to hasPermissionTo() & co., which stay pure data checks. | packages/core/src/rbac.ts:118 |
cache? | false | CacheStore | Cache store, or false to disable caching. Default: in-memory cache. | packages/core/src/rbac.ts:110 |
cacheTtl? | number | Cache TTL in milliseconds. Default: 24 hours. | packages/core/src/rbac.ts:112 |
defaultGuard? | DefaultGuardName<T> | Guard used when none is given. Default: web. With per-guard names (RbacTypeConfig['guards']), it must be the typed defaultGuard. | packages/core/src/rbac.ts:104 |
getActor? | ActorResolver | Returns who makes the current change, for the actor field of events, when a write call doesn't pass actor itself. Read it from your request context (e.g. an AsyncLocalStorage). Only called when an event has listeners. Default: none, and events carry no actor unless a call passes one. | packages/core/src/rbac.ts:136 |
names? | RbacNames<T> | The typed names as values, for isRoleName(rbac, value) / isPermissionName(rbac, value), which check user input against them. Optional; the engine itself does not use them. | packages/core/src/rbac.ts:141 |
now? | () => Date | The engine's clock, used to decide whether an assignment's expiresAt has passed. Inject one in tests to move time forward. Default: the system clock (new Date()). | packages/core/src/rbac.ts:146 |
superAdminRoles? | readonly RolesOf<GuardTypes<T, string>>[] | Subjects having ANY of these roles pass every can() check (super-admin). Evaluated after before (if before returned undefined). | packages/core/src/rbac.ts:123 |
teams? | boolean | Enable team-scoped roles & permissions (multi-tenancy). Default: false. | packages/core/src/rbac.ts:108 |
wildcard? | boolean | Enable wildcard permissions like articles.*. Default: false. | packages/core/src/rbac.ts:106 |
wildcardPrefixCheck? | WildcardPrefixCheck | With wildcard: true, what sync() and createPermission() do when one permission name implies another only because it is shorter (orders.refund implies orders.refund.large): 'warn' logs a one-time warning when NODE_ENV is development, 'error' throws before writing, 'off' says nothing. Default: 'warn'. | packages/core/src/rbac.ts:130 |
