Skip to content

Commit

Permalink
[TwigBridge] is_granted no longer raise an exception if the token sto…
Browse files Browse the repository at this point in the history
…rage is empty
  • Loading branch information
lyrixx committed Sep 28, 2015
1 parent 156368f commit 6be68fd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Symfony/Bridge/Twig/Extension/SecurityExtension.php
Expand Up @@ -13,6 +13,7 @@

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.
Expand All @@ -38,7 +39,11 @@ public function isGranted($role, $object = null, $field = null)
$object = new FieldVote($object, $field);
}

return $this->securityChecker->isGranted($role, $object);
try {
return $this->securityChecker->isGranted($role, $object);
} catch (AuthenticationCredentialsNotFoundException $e) {
return false;
}
}

/**
Expand Down

0 comments on commit 6be68fd

Please sign in to comment.