Interface: RbacNames<T>
Defined in: packages/core/src/names.ts:34
The typed names as values, for the isRoleName / isPermissionName type guards (createRbac({ names })). Types only exist at compile time, so the engine needs the lists to check user input.
Each entry must be one of the typed names. Derive the type from the lists to keep them complete:
ts
const roles = ['writer', 'editor', 'admin'] as const
type AppRbac = { roles: (typeof roles)[number] }
const rbac = createRbac<AppRbac>({ adapter, names: { roles } })With per-guard names, give each guard its lists in guards: names: { guards: { web: { roles }, api: { ... } } }.
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends RbacTypeConfig | DefaultRbacTypes |
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
guards? | { readonly [G in string]?: RbacGuardNames<T, G> } | Lists per guard, checked by isRoleName(rbac, value, { guard }) (the default guard's list without guard). A guard without a list here uses roles / permissions. | packages/core/src/names.ts:43 |
permissions? | readonly PermissionsOf<GuardTypes<T, string>>[] | Every permission name the app knows. Enables isPermissionName. Used for guards without their own list. | packages/core/src/names.ts:38 |
roles? | readonly RolesOf<GuardTypes<T, string>>[] | Every role name the app knows. Enables isRoleName. Used for guards without their own list. | packages/core/src/names.ts:36 |
