From b026a248e36e581fbada0a84162c08adb659913c Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 31 Jan 2024 15:40:44 +0100 Subject: [PATCH] #12805 ipam change permisions AW/PM --- pandora_console/godmode/menu.php | 47 ++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index a77e63b95b..3505e7cf2c 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -518,7 +518,18 @@ if ($access_console_node === true) { } -if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($config['id_user'], 0, 'DM') === true) { +if ((bool) check_acl($config['id_user'], 0, 'AW') === true) { + $show_ipam = false; + $ipam = db_get_all_rows_sql('SELECT users_operator FROM tipam_network'); + foreach ($ipam as $row) { + if (str_contains($row['users_operator'], '-1') || str_contains($row['users_operator'], $config['id_user'])) { + $show_ipam = true; + break; + } + } +} + +if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($config['id_user'], 0, 'DM') === true || $show_ipam === true) { $menu_godmode['gextensions']['text'] = __('Admin tools'); $menu_godmode['gextensions']['sec2'] = 'godmode/extensions'; $menu_godmode['gextensions']['id'] = 'god-extensions'; @@ -535,8 +546,6 @@ if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($ $sub['tools/diagnostics']['text'] = __('Diagnostic info'); $sub['tools/diagnostics']['id'] = 'diagnostic_info'; enterprise_hook('omnishell'); - enterprise_hook('ipam_submenu'); - $sub['godmode/setup/news']['text'] = __('Site news'); $sub['godmode/setup/news']['id'] = 'site_news'; } @@ -558,9 +567,15 @@ if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($ } } - $sub['godmode/events/configuration_sounds']['text'] = __('Acoustic console setup'); - $sub['godmode/events/configuration_sounds']['id'] = 'Acoustic console setup'; - $sub['godmode/events/configuration_sounds']['pages'] = ['godmode/events/configuration_sounds']; + if (((bool) check_acl($config['id_user'], 0, 'PM') === true && $access_console_node === true) || $show_ipam === true) { + enterprise_hook('ipam_submenu'); + } + + if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) check_acl($config['id_user'], 0, 'DM') === true) { + $sub['godmode/events/configuration_sounds']['text'] = __('Acoustic console setup'); + $sub['godmode/events/configuration_sounds']['id'] = 'Acoustic console setup'; + $sub['godmode/events/configuration_sounds']['pages'] = ['godmode/events/configuration_sounds']; + } $menu_godmode['gextensions']['sub'] = $sub; } @@ -638,16 +653,18 @@ if ($access_console_node === true) { } // Complete the submenu. - $extension_view = []; - $extension_view['godmode/extensions']['id'] = 'extension_manager_view'; - $extension_view['godmode/extensions']['text'] = __('Extension manager view'); - $extension_submenu = array_merge($extension_view, $sub2); + if (users_is_admin($config['id_user']) === true) { + $extension_view = []; + $extension_view['godmode/extensions']['id'] = 'extension_manager_view'; + $extension_view['godmode/extensions']['text'] = __('Extension manager view'); + $extension_submenu = array_merge($extension_view, $sub2); - $sub['godmode/extensions']['sub2'] = $extension_submenu; - $sub['godmode/extensions']['text'] = __('Extension manager'); - $sub['godmode/extensions']['id'] = 'extension_manager'; - $sub['godmode/extensions']['type'] = 'direct'; - $sub['godmode/extensions']['subtype'] = 'nolink'; + $sub['godmode/extensions']['sub2'] = $extension_submenu; + $sub['godmode/extensions']['text'] = __('Extension manager'); + $sub['godmode/extensions']['id'] = 'extension_manager'; + $sub['godmode/extensions']['type'] = 'direct'; + $sub['godmode/extensions']['subtype'] = 'nolink'; + } if (is_array($menu_godmode['gextensions']['sub']) === true) { $submenu = array_merge($menu_godmode['gextensions']['sub'], $sub);