@@ -204,7 +204,7 @@ user to be logged in to access this URL:
204
204
# ...
205
205
firewalls :
206
206
# ...
207
-
207
+
208
208
access_control :
209
209
# require ROLE_ADMIN for /admin*
210
210
- { path: ^/admin, roles: ROLE_ADMIN }
@@ -270,6 +270,7 @@ But who can you login as? Where do users come from?
270
270
or :doc: `build your own </cookbook/security/custom_authentication_provider >`.
271
271
272
272
.. _security-user-providers :
273
+ .. _where-do-users-come-from-user-providers :
273
274
274
275
B) Configuring how Users are Loaded
275
276
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -427,6 +428,7 @@ If you'd like to load your users via the Doctrine ORM, that's easy! See
427
428
:doc: `/cookbook/security/entity_provider ` for all the details.
428
429
429
430
.. _book-security-encoding-user-password :
431
+ .. _encoding-the-user-s-password :
430
432
431
433
C) Encoding the Users Password
432
434
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -668,7 +670,7 @@ URL pattern. You saw this earlier, where anything matching the regular expressio
668
670
# ...
669
671
firewalls :
670
672
# ...
671
-
673
+
672
674
access_control :
673
675
# require ROLE_ADMIN for /admin*
674
676
- { path: ^/admin, roles: ROLE_ADMIN }
@@ -834,9 +836,9 @@ in this chapter).
834
836
Be careful with this in your layout or on your error pages! Because of
835
837
some internal Symfony details, to avoid broken error pages in the ``prod ``
836
838
environment, wrap calls in these templates with a check for ``app.user ``:
837
-
839
+
838
840
.. code-block :: html+jinja
839
-
841
+
840
842
{% if app.user and is_granted('ROLE_ADMIN') %}
841
843
842
844
Securing other Services
@@ -970,7 +972,7 @@ the User object, and use the ``isGranted`` method (or
970
972
971
973
// boo :(. Never check for the User object to see if they're logged in
972
974
if ($this->getUser()) {
973
-
975
+
974
976
}
975
977
976
978
Retrieving the User in a Template
989
991
990
992
.. code-block :: html+php
991
993
992
- <?php if ($view['security']->isGranted('IS_AUTHENTICATED_FULLY')): ?>
994
+ <?php if ($view['security']->isGranted('IS_AUTHENTICATED_FULLY')): ?>
993
995
<p>Username: <?php echo $app->getUser()->getUsername() ?></p>
994
996
<?php endif; ?>
995
997
0 commit comments