[TwigBridge] is_granted no longer raise an exception if the token storage is empty
This commit is contained in:
parent
156368fa43
commit
6be68fd845
@ -13,6 +13,7 @@ namespace Symfony\Bridge\Twig\Extension;
|
||||
|
||||
use Symfony\Component\Security\Acl\Voter\FieldVote;
|
||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||
use Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException;
|
||||
|
||||
/**
|
||||
* SecurityExtension exposes security context features.
|
||||
@ -38,7 +39,11 @@ class SecurityExtension extends \Twig_Extension
|
||||
$object = new FieldVote($object, $field);
|
||||
}
|
||||
|
||||
try {
|
||||
return $this->securityChecker->isGranted($role, $object);
|
||||
} catch (AuthenticationCredentialsNotFoundException $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user