Skip to content

Commit 5c04c6b

Browse files
94noniOskarStark
authored andcommitted
Document twig functions on impersonation
1 parent 40d7fbf commit 5c04c6b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

security/impersonating_user.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ as the value to the current URL:
7070
7171
http://example.com/somewhere?_switch_user=thomas
7272
73+
.. tip::
74+
75+
You can leverage the Twig function ``impersonation_path('thomas')``
76+
77+
.. versionadded:: 6.4
78+
79+
The ``impersonation_path()`` function was introduced in Symfony 6.4.
80+
7381
.. tip::
7482

7583
Instead of adding a ``_switch_user`` query string parameter, you can pass
@@ -128,6 +136,10 @@ To switch back to the original user, use the special ``_exit`` username:
128136
129137
http://example.com/somewhere?_switch_user=_exit
130138
139+
.. tip::
140+
141+
You can leverage the Twig function ``impersonation_exit_path('/somewhere')``
142+
131143
This feature is only available to users with a special role called ``ROLE_ALLOWED_TO_SWITCH``.
132144
Using :ref:`role_hierarchy <security-role-hierarchy>` is a great way to give this
133145
role to the users that need it.

0 commit comments

Comments
 (0)