本文介绍了Symfony isGranted 不能处理继承的角色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个用户具有 PERM_USER_READ 的继承角色.
I have a user that has an inherited role of PERM_USER_READ.
当我尝试调用 $this->isGranted('PERM_USER_READ');
时,它总是返回 false.它是 isGranted()
的默认行为吗?如果是这样,我可以做些什么来评估我的 Twig 和控制器上继承的角色?
when i tried to call $this->isGranted('PERM_USER_READ');
it always returns false. Is it the default behavior of the isGranted()
? If so, what can i do to evaluate inherited roles on my Twig and Controllers?
谢谢!
推荐答案
尝试将您的角色重命名为 ROLE_PERM_USER_READ
Try to rename your role to ROLE_PERM_USER_READ
这篇关于Symfony isGranted 不能处理继承的角色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!