From d652e1d097aa5dad32d7cc114e08114970fdb301 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 5 Sep 2019 18:00:34 +0200 Subject: [PATCH] Be more explicit about the use of regular expressions in access_control --- security.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/security.rst b/security.rst index 96fa07973b4..228644c84ed 100644 --- a/security.rst +++ b/security.rst @@ -715,6 +715,10 @@ URL pattern. You saw this earlier, where anything matching the regular expressio # require ROLE_ADMIN for /admin* - { path: ^/admin, roles: ROLE_ADMIN } + # the 'path' value can be any valid regular expression + # (this one will match URLs like /api/post/7298 and /api/comment/528491) + - { path: ^/api/(post|comment)/\d+$, roles: ROLE_USER } + .. code-block:: xml @@ -734,6 +738,10 @@ URL pattern. You saw this earlier, where anything matching the regular expressio + + + @@ -752,6 +760,10 @@ URL pattern. You saw this earlier, where anything matching the regular expressio 'access_control' => [ // require ROLE_ADMIN for /admin* ['path' => '^/admin', 'role' => 'ROLE_ADMIN'], + + // the 'path' value can be any valid regular expression + // (this one will match URLs like /api/post/7298 and /api/comment/528491) + ['path' => '^/api/(post|comment)/\d+$', 'role' => 'ROLE_USER'], ], ]);