We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2e3a076 commit e18e809Copy full SHA for e18e809
security.rst
@@ -911,7 +911,8 @@ Users with the ``ROLE_ADMIN`` role will also have the
911
``ROLE_USER`` role. And users with ``ROLE_SUPER_ADMIN``, will automatically have
912
``ROLE_ADMIN``, ``ROLE_ALLOWED_TO_SWITCH`` and ``ROLE_USER`` (inherited from ``ROLE_ADMIN``).
913
914
-For role hierarchy to work, do not try to call ``$user->getRoles()`` manually in a controller::
+For role hierarchy to work, do not try to call ``$user->getRoles()`` manually.
915
+For example, in a controller extending from the :ref:`base controller <the-base-controller-class-services>`::
916
917
// BAD - $user->getRoles() will not know about the role hierarchy
918
$hasAccess = in_array('ROLE_ADMIN', $user->getRoles());
0 commit comments