Interface: SyncDefinition<T, G>
Defined in: packages/core/src/sync.ts:36
Declarative description of the roles & permissions of ONE guard (and optionally one team).
ts
await rbac.sync({
permissions: ['edit articles', 'delete articles'],
roles: { admin: '*', writer: ['edit articles'] },
})Pass an array of definitions to sync several guards / teams at once. With per-guard names (RbacTypeConfig['guards']), G is the guard whose names the block takes; see SyncDefinitions.
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends RbacTypeConfig | DefaultRbacTypes |
G extends string | DefaultGuardName<T> |
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
guard? | string | Guard of this block. Default: the guard option, then defaultGuard. | packages/core/src/sync.ts:38 |
permissions? | readonly PermissionsOf<GuardTypes<T, G>>[] | Permissions of the guard. Permissions referenced by a role are created too, even if not listed here. | packages/core/src/sync.ts:42 |
roles? | { readonly [R in string]?: SyncRolePermissions<T, G> } | Roles and their permissions. Each role's permissions are synced (replaced) to exactly this list. | packages/core/src/sync.ts:44 |
team? | TeamId | Team of the roles in this block (requires teams: true). Default: the team option, then global (null). | packages/core/src/sync.ts:40 |
