0

I'm working for a project where the menu bar needs to be a dynamic menu interacting with the roles defined for the users. It works with the Symfony 3.3.

The concept should be like this: '1' user have 'n' roles and each role should see 'm' options in the menu bar. And also, different roles can have the same option menu available. So the result shouldn't show the same option twice.

I've been exploring the different kinds of menus in the list of bundles availables and no one seems to match to this idea.

I know how to do it by myself but I wonder if anyone knows if exist any bundle who have this functionality or very similar to be able to use it or modify it easily to be able to use it.

The one I saw but it's not all I need is the most used for menus but I don't think can manage the role concept. If I'm wrong tell me plx.

What you suggest to do?

Thank you very much for your help!

1 Answers1

0

Follow this symfony documentation knpMenuBundle

Khadija
  • 310
  • 1
  • 9
  • Well... yes. Is the first one I was thinking about. The point is that I will have to apply the concept of the roles and options in the controller manually to build the final menu in each case, isn't it? I mean, there is no other bundle that could provide you already done an interface to manage all the options and roles, like an admin page to control all possible changes in these menus? – Ricard Espinàs Llovet Oct 16 '17 at 11:08
  • I have never used a bundle for this functionality, i only check the roles with an if statement then decide whether to show the option or not. sorry for not being able to help – Khadija Oct 16 '17 at 11:22
  • Oks you answered me anyway with sense... I was expecting magically to find more work done... but is enough... as you said I will manage the roles by myself. – Ricard Espinàs Llovet Oct 16 '17 at 12:53
  • Just register your menu as a service, inject `@security.authorization_checker`, and check for roles. http://symfony.com/doc/current/bundles/KnpMenuBundle/menu_service.html – dmnptr Oct 16 '17 at 14:12