我希望能够验证属性(角色)是否被授予在Symfony2中实现UserInterface的任意对象。这可能吗?UserInterface->getRoles()不适合我的需求,因为它没有考虑角色层次,我宁愿不在那个部门重新发明轮子,这就是为什么我如果可能,我想使用AccessDecisionManager。谢谢。针对下面Olivier的解决方案,以下是我的经验:Youcanusethesecurity.contextservicewiththeisGrantedmethod.Youcanpassasecondargumentwhichisyourobject.$user=newCore\