fix console report pandora_enterprise#6367

This commit is contained in:
Daniel Barbero 2022-08-08 13:51:07 +02:00
parent 743b1c295f
commit d9227fae0e
3 changed files with 69 additions and 27 deletions

View File

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

View File

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

View File

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