Reputation: 45094
I'm trying to use the switch_user
technique described in the Symfony2 security docs. Unfortunately, it doesn't work. When I browse to http://myurl.com/foo?_switch_user=bar
, the page gets refreshed, but I'm still logged in as the admin user, not bar
.
Here's the relevant part of my app/config/security.yml
:
role_hierarchy:
ROLE_ADMIN: ROLE_USER, ROLE_ALLOWED_TO_SWITCH
ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
providers:
administrators:
entity: { class: VNNPressboxBundle:User, property: username }
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
secured_area:
pattern: ^/
form_login: ~
logout: ~
anonymous: ~
switch_user: true
Any ideas as to what the issue is?
Upvotes: 5
Views: 397
Reputation:
Did you try clearing symfony cache? I had some unexplainable issues too that were fixed just by clearing it. It doesn't hurt to try :)
Update: After reading question comments, by the lack of debug bar, I can guess that you might be in production environment. This could be the source of your trouble. Try clearing cache and switching to dev environment by running this:
php app/console --env=dev cache:clear
Update2: Are you accessing your app via app_dev.php file ?
Upvotes: 2