Forums › Forums › Oro Community › How to add custom menu to roles
This topic contains 6 replies, has 4 voices, and was last updated by lvera 6 years, 7 months ago.
Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.
- CreatorTopic
- July 15, 2016 at 8:10 pm #24407
I created new bundle and add new menu i want to assign that menu using roles section but my custom menu is not showing in roles section.The requirement is i want to show that menu to some users only using role.
- CreatorTopic
- AuthorReplies
- July 19, 2016 at 8:37 am #24408
Hi,
What do you mean when you are saying about menu? What kind is menu? Where is located roles section?
July 19, 2016 at 10:27 am #24409Its not located role section i created a custom menu i want to hide menu for specific users is there is possible? to hide please see my screenshot http://prntscr.com/buvz9m
July 21, 2016 at 8:39 am #24410No, menu management for specific roles is not possible yet. We have plans to implement it later this year though.
July 21, 2016 at 10:00 pm #24411Is there is a way to create a registration page for users? I want a user registration
July 22, 2016 at 6:12 am #24412Not in OroCRM, but OroCommerce has a similar feature.
August 31, 2017 at 5:46 am #24413Hello, I used the Menu Builder from KnpMenu, you need create a class that implements the MenuBuilder and register in the services.yml, look the following code:
YAML1234567services:appbundle.menu.main:class: Live\Bundle\AppBundle\Menu\MainMenuBuilderarguments:- '@security.context'tags:- { name: oro_menu.builder, alias: application_menu }PHP123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293<?phpnamespace SystemBundle\Menu;use Symfony\Component\Security\Core\SecurityContextInterface;use Knp\Menu\ItemInterface;use Oro\Bundle\NavigationBundle\Menu\BuilderInterface;class MainMenuBuilder implements BuilderInterface{/*** @var SecurityContextInterface*/private $securityContext;/*** @param SecurityContextInterface $securityContext*/public function __construct(SecurityContextInterface $securityContext){$this->securityContext = $securityContext;}public function build(ItemInterface $menu, array $options = array(), $alias = null){$menu->setExtra('type', 'dropdown');$menu->addChild('reportes',array('uri' => '#','label' => 'Reportes','extras' => array('position' => 10)));if ($this->securityContext->isGranted('ROLE_ADMINISTRATOR')) {$menu->setExtra('type', 'dropdown');$menu->addChild('sistema',array('uri' => '#','label' => 'Sistema','extras' => array('position' => 20)));$menu['sistema']->addChild('configuracion',array('route' => 'oro_config_configuration_system', 'label' => 'Configuración'));$menu['sistema']->addChild('listado_usuarios',array('route' => 'oro_user_index', 'label' => 'Usuarios'));$menu['sistema']->addChild('listado_roles',array('route' => 'oro_user_role_index', 'label' => 'Roles'));$menu['sistema']->addChild('listado_tareas',array('route' => 'oro_cron_job_index', 'label' => 'Tareas Programadas'));$menu['reportes']->addChild('listado_reportes',array('route' => 'oro_report_index', 'label' => 'Reportes Personalizados'));}$menu['reportes']->addChild('rpt_equipos_por_organizacion_link',array('route' => 'appbundle.reportes_equipos_por_organizacion', 'label' => 'Equipos por Organizaciones'));$menu['reportes']->addChild('rpt_equipos_por_organizacion_zona_link',array('route' => 'appbundle.reportes_equipos_por_zona_organizacion', 'label' => 'Resumen Equipos por Zonas'));}}Greetings from Paraguay!
- AuthorReplies
The forum ‘Oro Community’ is closed to new topics and replies.