如何在不使用sonata admin的情况下为自定义路由设置自定义角色,但使用sonata管理菜单构建器。
sonata.admin.group.content:
label: test
label_catalogue: test
icon: '<i class="fa fa-file-text"></i>'
items:
- route: custom_route_1
label: 'custom_route_1'
- route: custom_route_2
label: 'custom_route_2'
- route: custom_route_3
label: 'custom_route_3'
我希望为菜单的每个元素设置单独的角色。
答案 0 :(得分:0)
您必须在yml代码中添加选项角色:
sonata.admin.group.content:
label: test
label_catalogue: test
icon: '<i class="fa fa-file-text"></i>'
items:
- route: custom_route_1
label: 'custom_route_1'
- route: custom_route_2
label: 'custom_route_2'
- route: custom_route_3
label: 'custom_route_3'
Roles : [ROLE_X, ROLES_Y,.....]