File tree 1 file changed +5
-1
lines changed
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -817,7 +817,7 @@ You can easily deny access from inside a controller::
817
817
$this->denyAccessUnlessGranted('ROLE_ADMIN', null, 'Unable to access this page!');
818
818
819
819
// Old way :
820
- // if (false === $this->get('security.context ')->isGranted('ROLE_ADMIN')) {
820
+ // if (false === $this->get('security.authorization_checker ')->isGranted('ROLE_ADMIN')) {
821
821
// throw $this->createAccessDeniedException('Unable to access this page!');
822
822
// }
823
823
@@ -829,6 +829,10 @@ You can easily deny access from inside a controller::
829
829
still now), you could check access directly and throw the ``AccessDeniedException `` as shown
830
830
in the example above).
831
831
832
+ .. versionadded :: 2.6
833
+ The ``security.authorization_checker `` service was introduced in Symfony 2.6. Prior
834
+ to Symfony 2.6, you had to use the ``isGranted() `` method of the ``security.context `` service.
835
+
832
836
In both cases, a special
833
837
:class: `Symfony\\ Component\\ Security\\ Core\\ Exception\\ AccessDeniedException `
834
838
is thrown, which ultimately triggers a 403 HTTP response inside Symfony.
You can’t perform that action at this time.
0 commit comments