From 1bc96e294110b9c7021da23966621d1f0c9f2f6a Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Thu, 28 Mar 2019 12:03:57 +0100 Subject: [PATCH 1/2] fix filepath --- security/access_control.rst | 2 +- security/form_login_setup.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/security/access_control.rst b/security/access_control.rst index 3d854352dba..c3fd28030d8 100644 --- a/security/access_control.rst +++ b/security/access_control.rst @@ -282,7 +282,7 @@ key: .. code-block:: xml - + loadFromExtension('security', [ From c1b85853c220ba0010ad0b50640df37d02ede672 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Thu, 28 Mar 2019 12:05:52 +0100 Subject: [PATCH 2/2] complete examples --- security/access_control.rst | 39 ++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/security/access_control.rst b/security/access_control.rst index c3fd28030d8..fef4b42a728 100644 --- a/security/access_control.rst +++ b/security/access_control.rst @@ -291,6 +291,7 @@ key: https://symfony.com/schema/dic/services/services-1.0.xsd"> + @@ -298,12 +299,16 @@ key: .. code-block:: php - 'access_control' => [ - [ - 'path' => '^/_internal/secure', - 'allow_if' => '"127.0.0.1" == request.getClientIp() or is_granted("ROLE_ADMIN")', + // config/packages/security.php + $container->loadFromExtension('security', [ + // ... + 'access_control' => [ + [ + 'path' => '^/_internal/secure', + 'allow_if' => '"127.0.0.1" == request.getClientIp() or is_granted("ROLE_ADMIN")', + ], ], - ], + ]); In this case, when the user tries to access any URL starting with ``/_internal/secure``, they will only be granted access if the IP address is ``127.0.0.1`` or if @@ -349,16 +354,20 @@ access those URLs via a specific port. This could be useful for example for xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + + .. code-block:: php // config/packages/security.php $container->loadFromExtension('security', [ + // ... 'access_control' => [ [ 'path' => '^/cart/checkout', @@ -396,16 +405,20 @@ the user will be redirected to ``https``: xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + + .. code-block:: php // config/packages/security.php $container->loadFromExtension('security', [ + // ... 'access_control' => [ [ 'path' => '^/cart/checkout',