i try :
in console :
php app/console fos:user:promote grek admin
Role "admin" has been added to user "grek".
if ($this->get('security.context')->isGranted('ROLE_ADMIN')) die('ok');
this is not show why ?
i log off, log in and same situtation
var_dump($this->get('security.context')->getToken()->getUser());
i>protected</i> 'roles' <font color='#888a85'>=></font>
<b>array</b> <i>(size=4)</i>
0 ADMIN'</font> <i>(length=5)</i>
1 OWNER'</font> <i>(length=5)</i>
2 TESTER'</font> <i>(length=6)</i>
$user = $this->get('security.context')->getToken()->getUser();
var_dump($user->getRoles());
array (size=1)
0 => string 'ROLE_USER' (length=9)
why $user->getRoles() give only one ?
when i add php app/console fos:user:promote grek ADMIN php app/console fos:user:promote grek ROLE_ADMIN php app/console fos:user:promote grek admin
then check - i dont have role in if ($this->get('security.context')->isGranted
And somethink else :
php app/console fos:user:promote grek test
Role "test" has been added to user "grek".
php app/console fos:user:demote grek test
User "grek" didn't have "test" role.
What is this ?