Skip to content

Commit

Permalink
Merge pull request #394 from itk-dev/feature/SUPP0RT-1234-logout-func…
Browse files Browse the repository at this point in the history
…tionality

#1234: Added logout functionality
  • Loading branch information
jekuaitk authored Apr 29, 2024
2 parents d4ee81c + 413a531 commit 676696e
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ about writing changes to this log.

## [Unreleased]

- [PR-394](https://github.com/itk-dev/naevnssekretariatet/pull/394)
Added logout functionality.
- [PR-393](https://github.com/itk-dev/naevnssekretariatet/pull/393)
Fixed `BoardRole` crud search property.
- [PR-392](https://github.com/itk-dev/naevnssekretariatet/pull/392)
Expand Down
2 changes: 2 additions & 0 deletions config/packages/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ security:
- ItkDev\OpenIdConnectBundle\Security\CliLoginTokenAuthenticator
- App\Security\AzureAdLoginAuthenticator
entry_point: App\Security\AzureAdLoginAuthenticator
logout:
path: app_logout

# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#firewalls-authentication
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Admin/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function configureActions(): Actions
public function configureUserMenu(UserInterface $user): UserMenu
{
// See AbstractDashboardController configureUserMenu method, here with unnecessary features such as logout removed
return UserMenu::new()
return parent::configureUserMenu($user)
->displayUserName()
->setName($user->getName())
;
Expand Down
9 changes: 9 additions & 0 deletions src/Controller/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,13 @@ public function redirectToUserSettings(AdminUrlGenerator $urlGenerator): Respons

return $this->redirect($url);
}

/**
* @Route("/logout", name="app_logout")
*/
public function logout(): void
{
// This will never be called so can be blank,
// cf. https://symfony.com/doc/5.x/security.html#logging-out
}
}
1 change: 1 addition & 0 deletions templates/navbar/_menu.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="user-menu">
{% if is_granted('ROLE_CASEWORKER') or is_granted('ROLE_ADMINISTRATION') %}
<a class="dropdown-item" href="{{ path('user_settings') }}">{% trans %}User settings{% endtrans %}</a>
<a class="dropdown-item" href="{{ path('app_logout') }}">{% trans %}Log out{% endtrans %}</a>
{% endif %}
</div>
</li>
Expand Down
4 changes: 4 additions & 0 deletions translations/navbar+intl-icu.da.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
<source>Create new</source>
<target>Opret ny</target>
</trans-unit>
<trans-unit id="SWFhRVF" resname="Log out">
<source>Log out</source>
<target state="translated">Log ud</target>
</trans-unit>
</body>
</file>
</xliff>
4 changes: 4 additions & 0 deletions translations/navbar+intl-icu.en.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
<source>User settings</source>
<target>User settings</target>
</trans-unit>
<trans-unit id="SWFhRVF" resname="Log out">
<source>Log out</source>
<target>Log out</target>
</trans-unit>
</body>
</file>
</xliff>

0 comments on commit 676696e

Please sign in to comment.