0

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, is 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?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
terrid25
  • 1,926
  • 8
  • 46
  • 87

1 Answers1

0

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.

Dziamid
  • 11,225
  • 12
  • 69
  • 104