简体   繁体   中英

show/hide some menus depend on the Sonata admin ROLE

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 ]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM