Error or bug with Symfony User updating roles

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Error or bug with Symfony User updating roles



This time I got a curious bug in my project managing the roles from a user.



I got installed the EasyAdmin bundle where I can manage the roles from the users. So I log with a user that have access to the EasyAdmin (ROLE_ADMIN in this case). Beside of this role I have also a few roles more, one of them, called ROLE_SUPERSUSER, where a user can edit 2 fields that the rest of users don't have the permission to edit them.



So throw the EasyAdmin, I remove the ROLE_SUPERSUSER from myself and here comes the gest of the matter. If I try to access to the edit zone from the profile if you have this ROLE_SUPERSUSER you will be able to edit this field, but because I removed it this role from myself, I expect to don't watch this fields over there. Instead of this, an error appears in the screen.



If I just logout and log in again the problem it's solved. But obviously I can't force the users to logout and login when I change their roles.



enter image description here



I guess the problem comes throw the cache but I don't find a solution.




1 Answer
1



Symfony roles are added on authentication by default, so you would have to re-login for this change to take effect.



You can change this in security.yml.


security.yml


security:
always_authenticate_before_granting: true






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Keycloak server returning user_not_found error when user is already imported with LDAP

PHP parse/syntax errors; and how to solve them?

How to scale/resize CVPixelBufferRef in objective C, iOS