Any role OR all roles required by Drupal routing.yml (examples)

my_custom_module1.routing.yml

 

Solution 1 (low level security: at least one of roles required):

my_custom_module1.section1:
  path: '/my/section/news-articles'
  defaults:
    _controller: '\Drupal\my_custom_module1\Controller\Section1Controller::main'
  requirements:
    _permission: 'access content'
    _role: 'redacteur+management+my_custom_role2+my_custom_role2'

 

Solution 2 (high level security: all of roles required):

my_custom_module1.section1:
  path: '/my/section/authorized-staff-only'
  defaults:
    _controller: '\Drupal\my_custom_module1\Controller\Secret1Controller::main'
  requirements:
    _permission: 'access content'
    _role: 'security,management,my_custom_role5,my_custom_role6'

 

Neuen Kommentar schreiben

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.

Suche

Neueste Kommentare