Skip to content

Commit caa2be6

Browse files
committed
minor #4737 [Book][Security] add missing versionadded directive (xabbuh)
This PR was merged into the 2.6 branch. Discussion ---------- [Book][Security] add missing versionadded directive | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | 2.6+ | Fixed tickets | The `versionadded` directive was present when #3995 was merged, but it apparently got lost in one the refactorings of the chapter afterwards. Commits ------- c0c6dab add missing versionadded directive
2 parents 57fdea6 + c0c6dab commit caa2be6

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

book/security.rst

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ user to be logged in to access this URL:
209209
# ...
210210
firewalls:
211211
# ...
212-
212+
213213
access_control:
214214
# require ROLE_ADMIN for /admin*
215215
- { path: ^/admin, roles: ROLE_ADMIN }
@@ -676,7 +676,7 @@ URL pattern. You saw this earlier, where anything matching the regular expressio
676676
# ...
677677
firewalls:
678678
# ...
679-
679+
680680
access_control:
681681
# require ROLE_ADMIN for /admin*
682682
- { path: ^/admin, roles: ROLE_ADMIN }
@@ -870,9 +870,9 @@ in this chapter).
870870
Be careful with this in your layout or on your error pages! Because of
871871
some internal Symfony details, to avoid broken error pages in the ``prod``
872872
environment, wrap calls in these templates with a check for ``app.user``:
873-
873+
874874
.. code-block:: html+jinja
875-
875+
876876
{% if app.user and is_granted('ROLE_ADMIN') %}
877877

878878
Securing other Services
@@ -1036,7 +1036,7 @@ the User object, and use the ``isGranted`` method (or
10361036

10371037
// boo :(. Never check for the User object to see if they're logged in
10381038
if ($this->getUser()) {
1039-
1039+
10401040
}
10411041

10421042
Retrieving the User in a Template
@@ -1055,7 +1055,7 @@ key:
10551055

10561056
.. code-block:: html+php
10571057

1058-
<?php if ($view['security']->isGranted('IS_AUTHENTICATED_FULLY')): ?>
1058+
<?php if ($view['security']->isGranted('IS_AUTHENTICATED_FULLY')): ?>
10591059
<p>Username: <?php echo $app->getUser()->getUsername() ?></p>
10601060
<?php endif; ?>
10611061

@@ -1148,7 +1148,7 @@ Next, you'll need to create a route for this URL (but not a controller):
11481148
return $collection;
11491149
11501150
And that's it! By sending a user to ``/logout`` (or whatever you configure
1151-
the ``path`` to be), Symfony will un-authenticate the current user. and
1151+
the ``path`` to be), Symfony will un-authenticate the current user. and
11521152
redirect them the homepage (the value defined by ``target``).
11531153

11541154
Once the user has been logged out, they will be redirected to whatever path
@@ -1180,6 +1180,9 @@ in the following way from a controller::
11801180

11811181
$user->setPassword($encoded);
11821182

1183+
.. versionadded:: 2.6
1184+
The ``security.password_encoder`` service was introduced in Symfony 2.6.
1185+
11831186
In order for this to work, just make sure that you have the encoder for your
11841187
user class (e.g. ``AppBundle\Entity\User``) configured under the ``encoders``
11851188
key in ``app/config/security.yml``.

0 commit comments

Comments
 (0)