我想检查是否为Symfony2中的特定用户授予了角色(而不是已登录的用户).我知道我可以通过以下方式检查登录用户:
$securityContext = $this->get('security.context');
if (false === $securityContext->isGranted('VIEW', $objectIdentity)) {
//do anything
}
Run Code Online (Sandbox Code Playgroud)
但如果我是已登录的用户,我的魔杖检查其他用户是否isGranted?