Skip to content

Commit 66831a6

Browse files
committed
Backporting some stuff from 2.7, that I think must have gotten merged only there by accident
1 parent ebca342 commit 66831a6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

book/security.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff 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+
832836
In both cases, a special
833837
:class:`Symfony\\Component\\Security\\Core\\Exception\\AccessDeniedException`
834838
is thrown, which ultimately triggers a 403 HTTP response inside Symfony.

0 commit comments

Comments
 (0)