V
V
Valery2013-02-18 22:18:57
symfony
Valery, 2013-02-18 22:18:57

Why don't groups work in FOSUserBundle?

Good evening,
Created a model of users and groups, connected them. To the user, gave him the admin group.
After that, he gave the group the role ROLE_CMS.
If the user calls getRoles(), then this role is present.
However, methods like isGranted(), i.e. those that are called from security.context for some reason do not find the role specified in the group.
What have I done wrong?
Let me explain with the controller code:

$this->getUser()->getRoles(); // array('ROLE_CMS', 'ROLE_USER');
$this->get('security.context')->isGranted('ROLE_CMS'); // false
$this->get('security.context')->isGranted('ROLE_USER'); // true

* The group contains only ROLE_CMS
* With ROLE_USER everything is clear, it is standard

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
stnw, 2013-02-19
@Akuma

Have you tried relogin?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question