Added list of roles to print after an API is generated

This commit is contained in:
Alejandro Celaya
2021-01-11 15:20:26 +01:00
parent 1f2e16184c
commit c49a0ca040
5 changed files with 38 additions and 10 deletions

View File

@@ -115,6 +115,11 @@ class ApiKey extends AbstractEntity
return $role === null ? [] : $role->meta();
}
public function mapRoles(callable $fun): array
{
return $this->roles->map(fn (ApiKeyRole $role) => $fun($role->name(), $role->meta()))->getValues();
}
public function registerRole(RoleDefinition $roleDefinition): void
{
$roleName = $roleDefinition->roleName();