File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 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::
817817 $this->denyAccessUnlessGranted('ROLE_ADMIN', null, 'Unable to access this page!');
818818
819819 // Old way :
820- // if (false === $this->get('security.context ')->isGranted('ROLE_ADMIN')) {
820+ // if (false === $this->get('security.authorization_checker ')->isGranted('ROLE_ADMIN')) {
821821 // throw $this->createAccessDeniedException('Unable to access this page!');
822822 // }
823823
@@ -829,6 +829,10 @@ You can easily deny access from inside a controller::
829829 still now), you could check access directly and throw the ``AccessDeniedException `` as shown
830830 in the example above).
831831
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+
832836In both cases, a special
833837:class: `Symfony\\ Component\\ Security\\ Core\\ Exception\\ AccessDeniedException `
834838is thrown, which ultimately triggers a 403 HTTP response inside Symfony.
You can’t perform that action at this time.
0 commit comments