@@ -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 }
@@ -427,9 +427,10 @@ If you'd like to load your users via the Doctrine ORM, that's easy! See
427
427
:doc: `/cookbook/security/entity_provider ` for all the details.
428
428
429
429
.. _book-security-encoding-user-password :
430
+ .. _c-encoding-the-users-password :
430
431
431
- C) Encoding the Users Password
432
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
432
+ C) Encoding the User's Password
433
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
433
434
434
435
Whether your users are stored in ``security.yml ``, in a database or somewhere
435
436
else, you'll want to encode their passwords. The best algorithm to use is
@@ -668,7 +669,7 @@ URL pattern. You saw this earlier, where anything matching the regular expressio
668
669
# ...
669
670
firewalls :
670
671
# ...
671
-
672
+
672
673
access_control :
673
674
# require ROLE_ADMIN for /admin*
674
675
- { path: ^/admin, roles: ROLE_ADMIN }
@@ -834,9 +835,9 @@ in this chapter).
834
835
Be careful with this in your layout or on your error pages! Because of
835
836
some internal Symfony details, to avoid broken error pages in the ``prod ``
836
837
environment, wrap calls in these templates with a check for ``app.user ``:
837
-
838
+
838
839
.. code-block :: html+jinja
839
-
840
+
840
841
{% if app.user and is_granted('ROLE_ADMIN') %}
841
842
842
843
Securing other Services
@@ -970,7 +971,7 @@ the User object, and use the ``isGranted`` method (or
970
971
971
972
// boo :(. Never check for the User object to see if they're logged in
972
973
if ($this->getUser()) {
973
-
974
+
974
975
}
975
976
976
977
Retrieving the User in a Template
989
990
990
991
.. code-block :: html+php
991
992
992
- <?php if ($view['security']->isGranted('IS_AUTHENTICATED_FULLY')): ?>
993
+ <?php if ($view['security']->isGranted('IS_AUTHENTICATED_FULLY')): ?>
993
994
<p>Username: <?php echo $app->getUser()->getUsername() ?></p>
994
995
<?php endif; ?>
995
996
0 commit comments