File tree 1 file changed +10
-0
lines changed
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -30,11 +30,17 @@ options are used for matching:
30
30
* ``host ``: a regular expression
31
31
* ``methods ``: one or many HTTP methods
32
32
* ``request_matcher ``: a service implementing ``RequestMatcherInterface ``
33
+ * ``attributes ``: is an array, which can be used to specify attributes of the query
34
+ * ``route ``: a route name
33
35
34
36
.. versionadded :: 6.1
35
37
36
38
The ``request_matcher `` option was introduced in Symfony 6.1.
37
39
40
+ .. versionadded :: 6.2
41
+
42
+ The ``route `` and ``attributes `` options were introduced in Symfony 6.2.
43
+
38
44
Take the following ``access_control `` entries as an example:
39
45
40
46
.. configuration-block ::
@@ -60,6 +66,10 @@ Take the following ``access_control`` entries as an example:
60
66
# for custom matching needs, use a request matcher service
61
67
- { roles: ROLE_USER, request_matcher: App\Security\RequestMatcher\MyRequestMatcher }
62
68
69
+ # require ROLE_ADMIN for 'admin' route. You can use the shortcut "route: xxx", instead of "attributes": ["_route": "xxx"].
70
+ - { attributes: {'_route': 'admin'}, roles: ROLE_ADMIN }
71
+ - { route: 'admin', roles: ROLE_ADMIN }
72
+
63
73
.. code-block :: xml
64
74
65
75
<!-- config/packages/security.xml -->
You can’t perform that action at this time.
0 commit comments