Change the role of a distant user without having to relog

后端 未结 3 586
抹茶落季
抹茶落季 2020-12-05 20:46

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 s

3条回答
  •  时光说笑
    2020-12-05 21:35

    Try this in your controller:

    $this->get('fos_user.user_manager')->refreshUser($user);
    

    See FOS/UserBundle/Model/UserManager.php

提交回复
热议问题