Skip to content

Commit

Permalink
[ManagedUser] add delegated indicator to role
Browse files Browse the repository at this point in the history
  • Loading branch information
ottaviano committed Jan 30, 2025
1 parent f9512c5 commit 5e56ae9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Entity/Projection/ManagedUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@ public function getRolesAsArray(): array
$rolePart = explode('|', $role);

$roleData['role'] = $rolePart[0];
$roleData['is_delegated'] = true;
$roleData['function'] = $rolePart[1];
}
$roles[] = $roleData;
Expand Down
6 changes: 5 additions & 1 deletion src/Normalizer/ManagedUserNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ public function normalize($object, $format = null, array $context = []): array|s
function (array $role) {
return [
'type' => 'role',
'label' => ($label = $this->translator->trans($key = 'role.'.$role['role'])) === $key ? $role['role'] : $label,
'label' => \sprintf(
'%s%s',
($label = $this->translator->trans($key = 'role.'.$role['role'])) === $key ? $role['role'] : $label,
!empty($role['is_delegated']) ? ' délégué' : ''
),
'tooltip' => $role['function'] ?? null,
];
},
Expand Down

0 comments on commit 5e56ae9

Please sign in to comment.