Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the role of a distant user without having to relog

I am trying to change the role of a user, using the FOSUserBundle. The problem is: if the user is logged at the same time, he has to relog to see the new role.

Any solutions ?

like image 317
Joffrey Avatar asked Feb 10 '12 00:02

Joffrey


1 Answers

According to the Security Configuration Reference, there's a always_authenticate_before_granting option. There's not much informations about that, but I've tried it with custom roles loading from database and it does the trick. It looks like everytime you will make a new request, the security component will reload roles.

So if you want to make sure your roles are refreshed and reloaded in your user session just set this option to truein your security.yml :

# app/config/security.yml
security:
    always_authenticate_before_granting:  false
like image 130
iamdto Avatar answered Nov 18 '22 10:11

iamdto