diff --git a/pandora_console/extensions/users_connected.php b/pandora_console/extensions/users_connected.php index 884285dd28..2848d4be9b 100644 --- a/pandora_console/extensions/users_connected.php +++ b/pandora_console/extensions/users_connected.php @@ -159,7 +159,7 @@ function users_extension_main_god($god=true) } -extensions_add_operation_menu_option(__('Users connected'), 'workspace', 'users/icon.png', 'v1r1', '', 'UM'); +extensions_add_operation_menu_option(__('Users connected'), 'workspace', 'users/icon.png', 'v1r1', null, 'UM'); extensions_add_godmode_function('users_extension_main_god'); extensions_add_main_function('users_extension_main'); diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index f8996328b3..67428da474 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -458,9 +458,9 @@ if (is_array($config['extensions'])) { $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['refr'] = 0; $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['icon'] = $extmenu['icon']; if ($extmenu['name'] == 'Cron jobs') { - $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['sec'] = 'extensions'; + $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['sec'] = $extmenu['fatherId']; } else { - $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['sec'] = 'gextensions'; + $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['sec'] = $extmenu['fatherId']; } $menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]['extension'] = true; @@ -521,8 +521,8 @@ $menu_godmode['links']['sub'] = $sub; // Update Manager if (check_acl($config['id_user'], 0, 'PM') && $config['enable_update_manager']) { $menu_godmode['messages']['text'] = __('Update manager'); - $menu_godmode['messages']['sec2'] = ''; $menu_godmode['messages']['id'] = 'god-um_messages'; + $menu_godmode['messages']['sec2'] = 'godmode/update_manager/update_manager'; $sub = []; if ($config['enterprise_installed']) { @@ -541,7 +541,6 @@ if (check_acl($config['id_user'], 0, 'PM') && $config['enable_update_manager']) // Module library. if (check_acl($config['id_user'], 0, 'AR')) { $menu_godmode['gmodule_library']['text'] = __('Module library'); - $menu_godmode['gmodule_library']['sec2'] = 'godmode/module_library/module_library_view'; $menu_godmode['gmodule_library']['id'] = 'god-module_library'; $sub = []; diff --git a/pandora_console/include/ajax/menu.ajax.php b/pandora_console/include/ajax/menu.ajax.php index 7b13f626f9..2ef22cd405 100644 --- a/pandora_console/include/ajax/menu.ajax.php +++ b/pandora_console/include/ajax/menu.ajax.php @@ -41,6 +41,8 @@ if ($get_sec_pages) { $pages = menu_get_sec_pages($sec, $menu_hash); } + $pages = menu_pepare_acl_select_data($pages, $sec); + echo json_encode($pages); return; } diff --git a/pandora_console/include/functions_menu.php b/pandora_console/include/functions_menu.php index 442a18f61f..432e350625 100644 --- a/pandora_console/include/functions_menu.php +++ b/pandora_console/include/functions_menu.php @@ -492,24 +492,16 @@ function menu_add_extras(&$menu) $menu_extra['gusuarios']['sub']['godmode/users/configure_user']['text'] = __('Configure user'); $menu_extra['gusuarios']['sub']['godmode/users/configure_profile']['text'] = __('Configure profile'); - $menu_extra['gservers']['sub']['godmode/servers/manage_recontask_form']['text'] = __('Manage recontask'); - $menu_extra['gmodules']['sub']['godmode/modules/manage_network_templates_form']['text'] = __('Module templates management'); $menu_extra['gmodules']['sub']['enterprise/godmode/modules/manage_inventory_modules_form']['text'] = __('Inventory modules management'); - $menu_extra['gmodules']['sub']['godmode/tag/edit_tag']['text'] = __('Tags management'); $menu_extra['gagente']['sub']['godmode/agentes/configurar_agente']['text'] = __('Agents management'); - $menu_extra['estado']['sub']['operation/agentes/ver_agente']['text'] = __('View agent'); - $menu_extra['galertas']['sub']['godmode/alerts/configure_alert_template']['text'] = __('Configure alert template'); - $menu_extra['network']['sub']['operation/agentes/networkmap']['text'] = __('Manage network map'); $menu_extra['network']['sub']['operation/visual_console/render_view']['text'] = __('View visual console'); $menu_extra['network']['sub']['godmode/reporting/visual_console_builder']['text'] = __('Builder visual console'); - $menu_extra['eventos']['sub']['godmode/events/events']['text'] = __('Administration events'); - $menu_extra['reporting']['sub']['operation/reporting/reporting_viewer']['text'] = __('View reporting'); $menu_extra['reporting']['sub']['operation/reporting/graph_viewer']['text'] = __('Graph viewer'); @@ -525,7 +517,6 @@ function menu_add_extras(&$menu) $menu_extra['godgismaps']['sub']['godmode/gis_maps/configure_gis_map']['text'] = __('Manage GIS Maps'); } - $menu_extra['workspace']['sub']['operation/incidents/incident_statistics']['text'] = __('Incidents statistics'); $menu_extra['workspace']['sub']['operation/messages/message_edit']['text'] = __('Manage messages'); $menu_extra['gagente']['sub']['godmode/groups/configure_group']['text'] = __('Manage groups'); @@ -534,7 +525,6 @@ function menu_add_extras(&$menu) $menu_extra['galertas']['sub']['godmode/alerts/configure_alert_action']['text'] = __('Manage alert actions'); $menu_extra['galertas']['sub']['godmode/alerts/configure_alert_command']['text'] = __('Manage commands'); - $menu_extra['galertas']['sub']['enterprise/godmode/alerts/alert_correlation']['text'] = __('Manage event alerts'); $menu_extra['gservers']['sub']['enterprise/godmode/servers/manage_export_form']['text'] = __('Manage export targets'); @@ -597,6 +587,10 @@ function menu_get_sec($with_categories=false) } } + if ($k === 'discovery') { + $in_godmode = true; + } + if ($in_godmode) { $category = __('Administration'); } else { @@ -673,6 +667,9 @@ function menu_get_sec_pages($sec, $menu_hash=false) // If this value has various parameters, we only get the first. $k = explode('&', $k); $k = $k[0]; + if (is_array($v['text']) === true) { + $v['text'] = $v['text'][0]; + } $sec2_array[$k] = $v['text']; } @@ -754,3 +751,47 @@ function menu_sec3_in_sec2($sec, $sec2, $sec3) return false; } + + +/** + * Prepare menu data for enterprise acl conf. + * + * @param array $pages + * @param string $sec + * @return string $pages + */ +function menu_pepare_acl_select_data($pages, $sec) +{ + $exclude_pages = [ + 'estado' => 'operation/agentes/tactical', + 'network' => 'operation/agentes/networkmap_list', + 'extensions' => [ + 'operation/extensions', + 'enterprise/extensions/vmware', + 'extensions/users_connected', + ], + 'gmodules' => 'godmode/modules/manage_network_templates', + 'geventos' => 'godmode/events/events&section=filter', + 'gsetup' => 'godmode/setup/setup§ion=general', + 'messages' => [ + 'godmode/update_manager/update_manager&tab=online', + 'godmode/update_manager/update_manager&tab=offline', + 'godmode/update_manager/update_manager&tab=setup', + ], + + ]; + + foreach ($exclude_pages as $exclude_sec => $sec2) { + if ($sec === $exclude_sec) { + if (is_array($sec2) === true) { + foreach ($sec2 as $value) { + unset($pages[$value]); + } + } + + unset($pages[$sec2]); + } + } + + return $pages; +} diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index 1d8178f1af..08cc0b0b57 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -545,7 +545,7 @@ if (is_array($config['extensions'])) { if (array_key_exists('fatherId', $extension_menu)) { // Check that extension father ID exists previously on the menu. if ((strlen($extension_menu['fatherId']) > 0)) { - if (array_key_exists('subfatherId', $extension_menu)) { + if (array_key_exists('subfatherId', $extension_menu) && empty($extension_menu['subfatherId']) === false) { if ((strlen($extension_menu['subfatherId']) > 0)) { $menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['text'] = __($extension_menu['name']); $menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['id'] = $extension_menu['name'];