Skip to content

Commit e6f5f38

Browse files
committed
minor #12538 extra code example (webmasterMeyers, Chad Meyers)
This PR was submitted for the 4.3 branch but it was merged into the 3.4 branch instead (closes #12538). Discussion ---------- extra code example document the ability to pass in multiple roles. Commits ------- 1531a2f include xml and php examples e58efe4 Update security.rst
2 parents 35b812c + 1531a2f commit e6f5f38

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

security.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,9 @@ URL pattern. You saw this earlier, where anything matching the regular expressio
715715
# require ROLE_ADMIN for /admin*
716716
- { path: '^/admin', roles: ROLE_ADMIN }
717717
718+
# or require ROLE_ADMIN and IS_AUTHENTICATED_FULLY for /admin*
719+
- { path: '^/admin', roles: [IS_AUTHENTICATED_FULLY, ROLE_ADMIN] }
720+
718721
# the 'path' value can be any valid regular expression
719722
# (this one will match URLs like /api/post/7298 and /api/comment/528491)
720723
- { path: ^/api/(post|comment)/\d+$, roles: ROLE_USER }
@@ -739,6 +742,12 @@ URL pattern. You saw this earlier, where anything matching the regular expressio
739742
<!-- require ROLE_ADMIN for /admin* -->
740743
<rule path="^/admin" role="ROLE_ADMIN"/>
741744
745+
<!-- require ROLE_ADMIN and IS_AUTHENTICATED_FULLY for /admin* -->
746+
<rule path="^/admin">
747+
<role>ROLE_ADMIN</role>
748+
<role>IS_AUTHENTICATED_FULLY</role>
749+
</rule>
750+
742751
<!-- the 'path' value can be any valid regular expression
743752
(this one will match URLs like /api/post/7298 and /api/comment/528491) -->
744753
<rule path="^/api/(post|comment)/\d+$" role="ROLE_USER"/>
@@ -761,6 +770,9 @@ URL pattern. You saw this earlier, where anything matching the regular expressio
761770
// require ROLE_ADMIN for /admin*
762771
['path' => '^/admin', 'roles' => 'ROLE_ADMIN'],
763772
773+
// require ROLE_ADMIN and IS_AUTHENTICATED_FULLY for /admin*
774+
['path' => '^/admin', 'roles' => ['ROLE_ADMIN', 'IS_AUTHENTICATED_FULLY']],
775+
764776
// the 'path' value can be any valid regular expression
765777
// (this one will match URLs like /api/post/7298 and /api/comment/528491)
766778
['path' => '^/api/(post|comment)/\d+$', 'roles' => 'ROLE_USER'],

0 commit comments

Comments
 (0)