diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index f8996328b3..a96d7c8238 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -250,20 +250,20 @@ if (check_acl($config['id_user'], 0, 'LW') $sub = []; if (check_acl($config['id_user'], 0, 'EW') || check_acl($config['id_user'], 0, 'EM')) { // Custom event fields - $sub['godmode/events/events&section=filter']['text'] = __('Event filters'); - $sub['godmode/events/events&section=filter']['id'] = 'Event filters'; + $sub['godmode/events/events§ion=filter']['text'] = __('Event filters'); + $sub['godmode/events/events§ion=filter']['id'] = 'Event filters'; } if (check_acl($config['id_user'], 0, 'PM')) { - $sub['godmode/events/events&section=fields']['text'] = __('Custom events'); - $sub['godmode/events/events&section=fields']['id'] = 'Custom events'; - $sub['godmode/events/events&section=responses']['text'] = __('Event responses'); - $sub['godmode/events/events&section=responses']['id'] = 'Event responses'; + $sub['godmode/events/events§ion=fields']['text'] = __('Custom events'); + $sub['godmode/events/events§ion=fields']['id'] = 'Custom events'; + $sub['godmode/events/events§ion=responses']['text'] = __('Event responses'); + $sub['godmode/events/events§ion=responses']['id'] = 'Event responses'; } if (!empty($sub)) { $menu_godmode['geventos']['text'] = __('Events'); - $menu_godmode['geventos']['sec2'] = 'godmode/events/events&section=filter'; + $menu_godmode['geventos']['sec2'] = 'godmode/events/events§ion=filter'; $menu_godmode['geventos']['id'] = 'god-events'; $menu_godmode['geventos']['sub'] = $sub; } @@ -303,7 +303,7 @@ if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, ' if (check_acl($config['id_user'], 0, 'PM')) { // Setup $menu_godmode['gsetup']['text'] = __('Setup'); - $menu_godmode['gsetup']['sec2'] = 'godmode/setup/setup§ion=general'; + $menu_godmode['gsetup']['sec2'] = 'general'; $menu_godmode['gsetup']['id'] = 'god-setup'; $sub = []; @@ -315,50 +315,50 @@ if (check_acl($config['id_user'], 0, 'PM')) { $sub['general']['subtype'] = 'nolink'; $sub2 = []; - $sub2['godmode/setup/setup&section=general']['text'] = __('General Setup'); - $sub2['godmode/setup/setup&section=general']['id'] = 'General Setup'; - $sub2['godmode/setup/setup&section=general']['refr'] = 0; + $sub2['godmode/setup/setup§ion=general']['text'] = __('General Setup'); + $sub2['godmode/setup/setup§ion=general']['id'] = 'General Setup'; + $sub2['godmode/setup/setup§ion=general']['refr'] = 0; enterprise_hook('password_submenu'); enterprise_hook('enterprise_submenu'); enterprise_hook('historydb_submenu'); enterprise_hook('log_collector_submenu'); - $sub2['godmode/setup/setup&section=auth']['text'] = __('Authentication'); - $sub2['godmode/setup/setup&section=auth']['refr'] = 0; + $sub2['godmode/setup/setup§ion=auth']['text'] = __('Authentication'); + $sub2['godmode/setup/setup§ion=auth']['refr'] = 0; - $sub2['godmode/setup/setup&section=perf']['text'] = __('Performance'); - $sub2['godmode/setup/setup&section=perf']['refr'] = 0; + $sub2['godmode/setup/setup§ion=perf']['text'] = __('Performance'); + $sub2['godmode/setup/setup§ion=perf']['refr'] = 0; - $sub2['godmode/setup/setup&section=vis']['text'] = __('Visual styles'); - $sub2['godmode/setup/setup&section=vis']['refr'] = 0; + $sub2['godmode/setup/setup§ion=vis']['text'] = __('Visual styles'); + $sub2['godmode/setup/setup§ion=vis']['refr'] = 0; if (check_acl($config['id_user'], 0, 'AW')) { if ($config['activate_netflow']) { - $sub2['godmode/setup/setup&section=net']['text'] = __('Netflow'); - $sub2['godmode/setup/setup&section=net']['refr'] = 0; + $sub2['godmode/setup/setup§ion=net']['text'] = __('Netflow'); + $sub2['godmode/setup/setup§ion=net']['refr'] = 0; } } - $sub2['godmode/setup/setup&section=ehorus']['text'] = __('eHorus'); - $sub2['godmode/setup/setup&section=ehorus']['refr'] = 0; + $sub2['godmode/setup/setup§ion=ehorus']['text'] = __('eHorus'); + $sub2['godmode/setup/setup§ion=ehorus']['refr'] = 0; - $sub2['godmode/setup/setup&section=integria']['text'] = __('Integria IMS'); - $sub2['godmode/setup/setup&section=integria']['refr'] = 0; + $sub2['godmode/setup/setup§ion=integria']['text'] = __('Integria IMS'); + $sub2['godmode/setup/setup§ion=integria']['refr'] = 0; enterprise_hook('module_library_submenu'); - $sub2['godmode/setup/setup&section=notifications']['text'] = __('Notifications'); - $sub2['godmode/setup/setup&section=notifications']['refr'] = 0; + $sub2['godmode/setup/setup§ion=notifications']['text'] = __('Notifications'); + $sub2['godmode/setup/setup§ion=notifications']['refr'] = 0; - $sub2['godmode/setup/setup&section=websocket_engine']['text'] = __('Websocket Engine'); - $sub2['godmode/setup/setup&section=websocket_engine']['refr'] = 0; + $sub2['godmode/setup/setup§ion=websocket_engine']['text'] = __('Websocket Engine'); + $sub2['godmode/setup/setup§ion=websocket_engine']['refr'] = 0; - $sub2['godmode/setup/setup&section=external_tools']['text'] = __('External Tools'); - $sub2['godmode/setup/setup&section=external_tools']['refr'] = 0; + $sub2['godmode/setup/setup§ion=external_tools']['text'] = __('External Tools'); + $sub2['godmode/setup/setup§ion=external_tools']['refr'] = 0; if ($config['activate_gis']) { - $sub2['godmode/setup/setup&section=gis']['text'] = __('Map conections GIS'); + $sub2['godmode/setup/setup§ion=gis']['text'] = __('Map conections GIS'); } $sub['general']['sub2'] = $sub2; 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..7a748c08c1 100644 --- a/pandora_console/include/functions_menu.php +++ b/pandora_console/include/functions_menu.php @@ -667,13 +667,11 @@ function menu_get_sec_pages($sec, $menu_hash=false) foreach ($menu[$sec]['sub'] as $k => $v) { // Avoid special cases of standalone windows. if (preg_match('/^javascript:/', $k) || preg_match('/\.php/', $k)) { - continue; + if ($sec !== 'links') { + continue; + } } - // If this value has various parameters, we only get the first. - $k = explode('&', $k); - $k = $k[0]; - $sec2_array[$k] = $v['text']; } } @@ -704,6 +702,7 @@ function menu_get_sec2_pages($sec, $sec2, $menu_hash=false) } $sec3_array = []; + $sec2 = io_safe_output($sec2); if (isset($menu[$sec]['sub']) && isset($menu[$sec]['sub'][$sec2]['sub2'])) { // Get the sec2 of the subsections. @@ -728,10 +727,6 @@ function menu_sec2_in_sec($sec, $sec2) { $sec2_array = menu_get_sec_pages($sec); - // If this value has various parameters, we only get the first. - $sec2 = explode('&', $sec2); - $sec2 = $sec2[0]; - if ($sec2_array != null && in_array($sec2, array_keys($sec2_array))) { return true; } @@ -744,13 +739,36 @@ function menu_sec3_in_sec2($sec, $sec2, $sec3) { $sec3_array = menu_get_sec2_pages($sec, $sec2, $menu_hash = false); - // If this value has various parameters, we only get the first. - $sec3 = explode('&', $sec3); - $sec3 = $sec3[0]; - if ($sec3_array != null && in_array($sec3, array_keys($sec3_array))) { return true; } 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 = ['discovery' => 'godmode/servers/discovery']; + + 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; +}