symfony - admin bar based of sfDoctrineGuard groups/permissions
I am working on a project, whereby I have several groups, several permissions and the groups then have specific permissions, using sfDoctrineGuard.
I have 5 modules and what I'm looking to do, 开发者_如何学Gois only show specific module links in the admin bar, depending on which user is logged in, via their groups permissions.
I'm not sure how I'd do this without creating several menu methods with the links hard-coded and then just checking what group the user was in and then displaying the particular menu method, but this seems clunky.
Does anyone have a much more streamlined way of how I could do this?
ioMenuPlugin is probably the best you can find out there. It allows you to define your menu entries in app.yml. You can also set credentials there, for example:
//apps/backend/config/app.yml
all:
menu:
backend_menu:
children:
home:
label: Homepage
route: homepage
app:
label: Your applications
route: application
profile:
label: Settings
route: profile
credentials: [admin]
'profile' menu entry will be visible only to users that have 'admin' credential.
精彩评论