From d9227fae0eab3be6111c34a468e5f961a8b4003d Mon Sep 17 00:00:00 2001 From: Daniel Barbero Date: Mon, 8 Aug 2022 13:51:07 +0200 Subject: [PATCH] fix console report pandora_enterprise#6367 --- pandora_console/include/functions.php | 42 ++++++++++++++++--- pandora_console/include/functions_cron.php | 47 ++++++++++++---------- pandora_console/index.php | 7 +++- 3 files changed, 69 insertions(+), 27 deletions(-) diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index f2a2a51508..14a533a93c 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -6106,7 +6106,7 @@ function is_reporting_console_node() * * @return boolean */ -function acl_reporting_console_node($path) +function acl_reporting_console_node($path, $tab='') { global $config; if (is_reporting_console_node() === false) { @@ -6114,17 +6114,49 @@ function acl_reporting_console_node($path) } if (is_metaconsole() === true) { + if ($path === 'advanced/metasetup') { + switch ($tab) { + case 'update_manager_online': + case 'update_manager_offline': + case 'update_manager_history': + case 'update_manager_setup': + case 'file_manager': + return true; + + default: + return false; + } + } + + if ($path === 'advanced/users_setup') { + switch ($tab) { + case 'user_edit': + return true; + + default: + return false; + } + } + if ($path === $config['homedir'].'/godmode/users/configure_user' - || $path === 'advanced/users_setup' - || $path === 'advanced/metasetup' || $path === 'advanced/links' || $path === $config['homedir'].'/enterprise/extensions/cron' ) { return true; } } else { - if ($path === 'godmode/servers/discovery' - || $path === 'operation/users/user_edit' + if ($path === 'godmode/servers/discovery') { + switch ($tab) { + case 'main': + case 'tasklist': + return true; + + default: + return false; + } + } + + if ($path === 'operation/users/user_edit' || $path === 'operation/users/user_edit_notifications' || $path === 'godmode/setup/file_manager' || $path === 'godmode/update_manager/update_manager' diff --git a/pandora_console/include/functions_cron.php b/pandora_console/include/functions_cron.php index 9cb2b42625..ff5a701ec1 100644 --- a/pandora_console/include/functions_cron.php +++ b/pandora_console/include/functions_cron.php @@ -492,7 +492,10 @@ function cron_list_table() $table->head[4] = __('Next execution'); $table->head[5] = __('Last run'); $table->head[6] = __('Group'); - $table->head[7] = __('Actions'); + if ($manage_perms || $manage_pandora) { + $table->head[7] = __('Actions'); + } + $table->align[7] = 'left'; foreach ($defined_tasks as $task) { @@ -602,7 +605,7 @@ function cron_list_table() break; case 'cron_task_generate_report_by_template': - if ((bool) $task['enabled'] === true && ($write_perms === true || $manage_pandora === true)) { + if ((bool) $task['enabled'] === true) { $data[0] = html_print_anchor( [ 'href' => sprintf( @@ -954,25 +957,27 @@ function cron_list_table() } } - $data[7] .= html_print_anchor( - [ - 'href' => sprintf( - '%stoggle_console_task=%s&id_user_task=%s', - $url, - ((bool) $task['enabled'] === true) ? '0' : '1', - $task['id'] - ), - 'content' => html_print_image( - ((bool) $task['enabled'] === true) ? 'images/lightbulb.png' : 'images/lightbulb_off.png', - true, - [ - 'title' => ((bool) $task['enabled'] === true) ? __('Disable task') : __('Enable task'), - 'class' => 'invert_filter', - ] - ), - ], - true - ); + if ($manage_perms || $manage_pandora) { + $data[7] .= html_print_anchor( + [ + 'href' => sprintf( + '%stoggle_console_task=%s&id_user_task=%s', + $url, + ((bool) $task['enabled'] === true) ? '0' : '1', + $task['id'] + ), + 'content' => html_print_image( + ((bool) $task['enabled'] === true) ? 'images/lightbulb.png' : 'images/lightbulb_off.png', + true, + [ + 'title' => ((bool) $task['enabled'] === true) ? __('Disable task') : __('Enable task'), + 'class' => 'invert_filter', + ] + ), + ], + true + ); + } array_push($table->data, $data); } diff --git a/pandora_console/index.php b/pandora_console/index.php index 9aec60c841..ad0e37c505 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -1240,7 +1240,12 @@ if ($searchPage) { $sec2 = ''; } - $acl_reporting_console_node = acl_reporting_console_node($page); + $tab = get_parameter('tab', ''); + if (empty($tab) === true) { + $tab = get_parameter('wiz', ''); + } + + $acl_reporting_console_node = acl_reporting_console_node($page, $tab); if ($acl_reporting_console_node === false) { include 'general/reporting_console_node.php'; exit;