Skip to content

Commit 24dd511

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: Adding `path` Fixing bad path for class PdoSessionHandler Fix typos: DNS -> DSN Fix term Fix logout on form login setup Change char to varchar type Use redirectToRoute [#13980] add annotation config example [Validator] Made the code sample more explicit with accepted values Update voters.rst Update voters.rst Update voters.rst Update security/voters.rst Update voters.rst [#13554] Slightly reworded the tip Update voters.rst Explaining controllers as viable alternative
2 parents 5203e78 + 0abf218 commit 24dd511

File tree

9 files changed

+51
-25
lines changed

9 files changed

+51
-25
lines changed

components/http_foundation.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ or change its ``Content-Disposition``::
639639
'filename.txt'
640640
);
641641

642-
It is possible to delete the file after the request is sent with the
642+
It is possible to delete the file after the response is sent with the
643643
:method:`Symfony\\Component\\HttpFoundation\\BinaryFileResponse::deleteFileAfterSend` method.
644644
Please note that this will not work when the ``X-Sendfile`` header is set.
645645

controller/upload_file.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ Finally, you need to update the code of the controller that handles the form::
171171

172172
// ... persist the $product variable or any other work
173173

174-
return $this->redirect($this->generateUrl('app_product_list'));
174+
return $this->redirectToRoute('app_product_list');
175175
}
176176

177177
return $this->render('product/new.html.twig', [

mailer.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Transport Setup
1919
---------------
2020

2121
Emails are delivered via a "transport". Out of the box, you can deliver emails
22-
over SMTP by configuring the DNS in your ``.env`` file (the ``user``,
22+
over SMTP by configuring the DSN in your ``.env`` file (the ``user``,
2323
``pass`` and ``port`` parameters are optional):
2424

2525
.. code-block:: env
@@ -83,7 +83,7 @@ transport, but you can force to use one:
8383
# force to use SMTP instead of HTTP (which is the default)
8484
MAILER_DSN=sendgrid+smtp://$SENDGRID_KEY@default
8585
86-
This table shows the full list of available DNS formats for each third
86+
This table shows the full list of available DSN formats for each third
8787
party provider:
8888

8989
==================== ========================================== =========================================== ========================================

reference/configuration/security.rst

+8
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,14 @@ the current firewall and not the other ones.
540540

541541
.. _reference-security-logout-success-handler:
542542

543+
``path``
544+
~~~~~~~~
545+
546+
**type**: ``string`` **default**: ``/logout``
547+
548+
The path which triggers logout. If you change it from the default value ``/logout``,
549+
you need to set up a route with a matching path.
550+
543551
success_handler
544552
~~~~~~~~~~~~~~~
545553

reference/constraints/Collection.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ you can do the following:
209209
* }
210210
* )
211211
*/
212-
protected $profileData = ['personal_email'];
212+
protected $profileData = ['personal_email' => '[email protected]'];
213213
}
214214
215215
.. code-block:: yaml

security/form_login_setup.rst

+19-12
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,13 @@ Edit the ``security.yaml`` file in order to declare the ``/logout`` path:
9999
security:
100100
# ...
101101
102-
providers:
103-
# ...
104-
logout:
105-
path: app_logout
106-
# where to redirect after logout
107-
# target: app_any_route
102+
firewalls:
103+
main:
104+
# ...
105+
logout:
106+
path: app_logout
107+
# where to redirect after logout
108+
# target: app_any_route
108109
109110
.. code-block:: xml
110111
@@ -119,8 +120,11 @@ Edit the ``security.yaml`` file in order to declare the ``/logout`` path:
119120
https://symfony.com/schema/dic/security/security-1.0.xsd">
120121
121122
<config>
122-
<rule path="^/login$" role="IS_AUTHENTICATED_ANONYMOUSLY"/>
123123
<!-- ... -->
124+
<firewall name="main">
125+
<!-- ... -->
126+
<logout path="app_logout"/>
127+
</firewall>
124128
</config>
125129
</srv:container>
126130
@@ -129,12 +133,15 @@ Edit the ``security.yaml`` file in order to declare the ``/logout`` path:
129133
// config/packages/security.php
130134
$container->loadFromExtension('security', [
131135
// ...
132-
'access_control' => [
133-
[
134-
'path' => '^/login',
135-
'roles' => 'IS_AUTHENTICATED_ANONYMOUSLY',
136+
'firewalls' => [
137+
'main' => [
138+
// ...
139+
'logout' => [
140+
'path' => 'app_logout',
141+
// where to redirect after logout
142+
'target' => 'app_any_route'
143+
],
136144
],
137-
// ...
138145
],
139146
]);
140147

security/remember_me.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ so ``DoctrineTokenProvider`` can store the tokens:
261261
262262
CREATE TABLE `rememberme_token` (
263263
`series` char(88) UNIQUE PRIMARY KEY NOT NULL,
264-
`value` char(88) NOT NULL,
264+
`value` varchar(88) NOT NULL,
265265
`lastUsed` datetime NOT NULL,
266266
`class` varchar(100) NOT NULL,
267267
`username` varchar(200) NOT NULL

security/voters.rst

+17-6
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,30 @@
66
How to Use Voters to Check User Permissions
77
===========================================
88

9-
Security voters are the most granular way of checking permissions (e.g. "can this
10-
specific user edit the given item?"). This article explains voters in detail.
9+
Voters are Symfony's most powerful way of managing permissions. They allow you
10+
to centralize all permission logic, then reuse them in many places.
11+
12+
However, if you don't reuse permissions or your rules are basic, you can always
13+
put that logic directly into your controller instead. Here's an example how
14+
this could look like, if you want to make a route accessible to the "owner" only::
15+
16+
// src/AppBundle/Controller/PostController.php
17+
// ...
18+
19+
if ($post->getOwner() !== $this->getUser()) {
20+
throw $this->createAccessDeniedException();
21+
}
22+
23+
In that sense, the following example used throughout this page is a minimal
24+
example for voters.
1125

1226
.. tip::
1327

1428
Take a look at the
1529
:doc:`authorization </components/security/authorization>`
1630
article for an even deeper understanding on voters.
1731

18-
How Symfony Uses Voters
19-
-----------------------
20-
21-
In order to use voters, you have to understand how Symfony works with them.
32+
Here's how Symfony works with voters:
2233
All voters are called each time you use the ``isGranted()`` method on Symfony's
2334
authorization checker or call ``denyAccessUnlessGranted()`` in a controller (which
2435
uses the authorization checker), or by

session/database.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ Preparing the Database to Store Sessions
358358

359359
Before storing sessions in the database, you must create the table that stores
360360
the information. The session handler provides a method called
361-
:method:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\PdoSessionHandler::createTable`
361+
:method:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\PdoSessionHandler::createTable`
362362
to set up this table for you according to the database engine used::
363363

364364
try {

0 commit comments

Comments
 (0)