From 14e785a6893408e52312a84b779adcc62f1177e3 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Diaz Date: Mon, 13 Jul 2015 18:03:16 +0200 Subject: [PATCH] Change permissions to a non-privilege user in planned-downtimes-acl Ticket #2404 (cherry picked from commit 8906e050ae273b454e43543e4d9754d0eb0197ae) --- .../godmode/agentes/planned_downtime.list.php | 68 ++++++++++++------- 1 file changed, 43 insertions(+), 25 deletions(-) diff --git a/pandora_console/godmode/agentes/planned_downtime.list.php b/pandora_console/godmode/agentes/planned_downtime.list.php index 88d93eaaa3..8ecf158adb 100755 --- a/pandora_console/godmode/agentes/planned_downtime.list.php +++ b/pandora_console/godmode/agentes/planned_downtime.list.php @@ -528,38 +528,56 @@ else { array ('width' => 20, 'height' => 20, 'alt' => __('Not executed'))); } - if ($downtime['type_execution'] == 'once' && $downtime["executed"] == 1) { + //If user have writting permissions + if ( check_acl ($config['id_user'], 0, "AW")) { + if ($downtime['type_execution'] == 'once' && $downtime["executed"] == 1) { + + $data[7] .= '' . + html_print_image("images/cancel.png", true, array("border" => '0', "alt" => __('Stop downtime'))); + } + else { + $data[7] = ""; + } - $data[7] .= '' . - html_print_image("images/cancel.png", true, array("border" => '0', "alt" => __('Stop downtime'))); + if ($downtime["executed"] == 0) { + $data[8] = '' . + html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . ''; + if (check_acl ($config['id_user'], 0, "AW")) { + $data[9] = '' . + html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))); + } + } + elseif ($downtime["executed"] == 1 + && $downtime['type_execution'] == 'once') { + + $data[8] = '' . + html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . ''; + $data[9]= "N/A"; + } + else { + $data[8]= "N/A"; + $data[9]= "N/A"; + } } - else { - $data[7] = ""; - } - - if ($downtime["executed"] == 0) { - $data[8] = '' . - html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . ''; - if (check_acl ($config['id_user'], 0, "AW")) { - $data[9] = '' . - html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))); + else{ + if ($downtime['type_execution'] == 'once' && $downtime["executed"] == 1) { + $data[7] .= ''; } } elseif ($downtime["executed"] == 1 && $downtime['type_execution'] == 'once') { - $data[8] = '' . - html_print_image("images/config.png", true, - array("border" => '0', "alt" => __('Update'))) . ''; - $data[9]= "N/A"; - } - else { - $data[8]= "N/A"; - $data[9]= "N/A"; - + if ($downtime["executed"] == 0) { + $data[8] = ''; + $data[9] = ''; + } + elseif ($downtime["executed"] == 1 && $downtime['type_execution'] == 'once') { + $data[8] = ''; + $data[9]= ''; + } } if (!empty($malformed_downtimes_exist) && isset($malformed_downtimes[$downtime['id']])) {