问题描述
我正在使用Symfony2进行Web项目,并且我在管理面板上使用了Sonata Admin,每件事都很好,但是我想做的是,在Sonata Admin的仪表板菜单上,我需要显示一些隐藏的东西菜单依赖于管理员的角色,所以任何人都这样做还是知道该怎么做? 我尝试使用角色的配置
- { path: ^/admin, role: [ROLE_ADMIN, ROLE_SONATA_ADMIN,ROLE_ADMIN_NEWS] }
谢谢
推荐答案
我找到了解决方案,我只需要在config.yml上定义
上的组dashboard: groups: Content: label: Content items: - sonata.admin.pages - sonata.admin.menus roles: [ ROLE_ADMIN_CONTENT, ROLE_SUPER_ADMIN ]
问题描述
I'm working on a web project using Symfony2 , and i used Sonata Admin for the admin Panel , every thing works fine but what i want to do is ,on the dashboard menus of sonata Admin , i need to show hide some menus depend on the admin ROLE , so did any one do this before or know how to do it ? i tryed to use the config of the roles but when i'm connecting with a ROlE diffrent of ROLE_SONATA_ADMIN the top menu dont show up ,
- { path: ^/admin, role: [ROLE_ADMIN, ROLE_SONATA_ADMIN,ROLE_ADMIN_NEWS] }
thanks
推荐答案
i found the solution for this i need just to define the groups on the config.yml Like this
dashboard: groups: Content: label: Content items: - sonata.admin.pages - sonata.admin.menus roles: [ ROLE_ADMIN_CONTENT, ROLE_SUPER_ADMIN ]