Deleted and reubicated acl options

This commit is contained in:
Calvo 2021-07-30 13:49:22 +02:00
parent 5aef20ee31
commit 9b736d0c48
5 changed files with 58 additions and 16 deletions

View File

@ -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');

View File

@ -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 = [];

View File

@ -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;
}

View File

@ -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&section=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;
}

View File

@ -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'];