show/hide some menus depend on the Sonata admin ROLE

依然范特西╮ 提交于 2019-12-19 04:04:09

问题


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


回答1:


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 ]


来源:https://stackoverflow.com/questions/22336623/show-hide-some-menus-depend-on-the-sonata-admin-role

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!