Skip to content

Commit

Permalink
imp: Display the user organization automatically calculated
Browse files Browse the repository at this point in the history
  • Loading branch information
marien-probesys committed Nov 20, 2024
1 parent 30f3bee commit 565e10c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/Controller/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,20 @@ public function show(
Entity\User $user,
Repository\AuthorizationRepository $authorizationRepository,
Sorter\AuthorizationSorter $authorizationSorter,
Service\UserService $userService,
): Response {
$this->denyAccessUnlessGranted('admin:manage:users');

$defaultOrganization = $userService->getDefaultOrganization($user);

$authorizations = $authorizationRepository->findBy([
'holder' => $user,
]);
$authorizationSorter->sort($authorizations);

return $this->render('users/show.html.twig', [
'user' => $user,
'defaultOrganization' => $defaultOrganization,
'authorizations' => $authorizations,
]);
}
Expand Down
12 changes: 8 additions & 4 deletions templates/users/show.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,15 @@
</p>
{% endif %}

{% if user.organization %}
<p>
<p>
{% if user.organization %}
{{ 'users.show.organization' | trans({ name: user.organization.name }) }}
</p>
{% endif %}
{% elseif defaultOrganization %}
{{ 'users.show.organization_automatic' | trans({ name: defaultOrganization.name }) }}
{% else %}
{{ 'users.show.no_organization' | trans }}
{% endif %}
</p>
</div>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions translations/messages+intl-icu.en_GB.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,8 @@ users.show.edit: 'Edit the user'
users.show.email: 'Email: {email}'
users.show.ldap_identifier: 'LDAP identifier: {identifier}'
users.show.name: 'Name: {name}'
users.show.no_organization: 'Organization: None'
users.show.organization: 'Organization: {name}'
users.show.organization_automatic: 'Organization: {name} (automatic)'
users.show.profile: 'User profile'
users.yourself: yourself
2 changes: 2 additions & 0 deletions translations/messages+intl-icu.fr_FR.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,8 @@ users.show.edit: 'Modifier l’utilisateur'
users.show.email: "Email\_: {email}"
users.show.ldap_identifier: "Identifiant LDAP\_: {identifier}"
users.show.name: "Nom\_: {name}"
users.show.no_organization: "Organisation\_: Aucune"
users.show.organization: "Organisation\_: {name}"
users.show.organization_automatic: "Organisation\_: {name} (automatique)"
users.show.profile: 'Profil utilisateur'
users.yourself: vous

0 comments on commit 565e10c

Please sign in to comment.