【发布时间】:2021-03-27 00:31:51
【问题描述】:
在我阅读了食谱中的这一章之后
http://symfony.com/doc/current/cookbook/security/entity_provider.html
我创建了一个实现“AdvancedUserInterface”的实体“User”和一个实现“RoleInterface”的实体“Roles”。我还在我的“security.yml”中创建了一个角色结构。
用户和角色之间的关系是“多对多”关系。
一切都很好。
对于已登录的用户,我可以像这样检查授权:
$this->get('security.context')->isGranted("ROLE_EDITOR");
但是我怎样才能检查数据库中其他用户的这个授权呢?
有类似的吗?
$this->get('security.context')->isGranted("ROLE_EDITOR", $user);
【问题讨论】:
标签: symfony