UserHasRolesTrait
Standalone trait for the `user_has_roles` Edges model dependency.
Tags
Table of Contents
Constants
- USER_HAS_ROLES : string = 'userHasRoles'
- Initialization key for the user_has_roles Edges model.
Properties
- $userHasRoles : Edges|null
- The user_has_roles Edges model.
Methods
- assignRoles() : void
- Assign specific roles to a newly created user.
- initializeUserHasRoles() : static
- Initializes the user_has_roles edges dependency from the $init array.
Constants
USER_HAS_ROLES
Initialization key for the user_has_roles Edges model.
public
string
USER_HAS_ROLES
= 'userHasRoles'
Properties
$userHasRoles
The user_has_roles Edges model.
protected
Edges|null
$userHasRoles
= null
Methods
assignRoles()
Assign specific roles to a newly created user.
protected
assignRoles(string $userKey, array<string|int, mixed> $roleKeys) : void
Creates edges in ArangoDB. The user→role grouping is then materialized into Casbin by the model-layer signals; Zitadel is not involved (RBAC lives in Arango + Casbin).
Parameters
- $userKey : string
-
The ArangoDB _key of the created user.
- $roleKeys : array<string|int, mixed>
-
The list of role _keys to assign.
Tags
initializeUserHasRoles()
Initializes the user_has_roles edges dependency from the $init array.
protected
initializeUserHasRoles(array<string|int, mixed> $init, Container|null $container) : static
Parameters
- $init : array<string|int, mixed>
-
The initialization array.
- $container : Container|null
-
The DI container.