User ImpersonationΒΆ
To enable the user impersonation links you must first enable the impersonation feature in your
firewall. Once you have enabled the feature, you will need to ensure that the user that you wish
to role switch from has the ROLE_ALLOWED_TO_SWITCH
role.
role_hierarchy:
...
ROLE_SUPER_ADMIN: [ROLE_SONATA_ADMIN, ROLE_ALLOWED_TO_SWITCH]
firewalls:
main:
...
admin:
...
switch_user: true
Please note that sessions are not shared by default over different firewalls (for example, if you
are trying to switch to a user who is authenticated on another firewall, such as main
given in
the example above). To enable this feature please refer to the
Symfony Documentation.
Then is it simply a case of providing the route name to redirect to once the user has been impersonated
in the NucleosUserAdminBundle
configuration:
nucleos_user_admin:
...
impersonating:
route: sonata_admin_dashboard
Here we have used the admin dashboard route, but you can supply any named route in your application.