Only show force button when user have a correct permmisions. Ticket: #3912

(cherry picked from commit 2476e499cf)
This commit is contained in:
m-lopez-f 2016-11-03 15:41:31 +01:00
parent e2e681ea0c
commit de9ac07ad1
4 changed files with 38 additions and 28 deletions

View File

@ -690,8 +690,8 @@ if ($list_modules) {
$table->data = array (); $table->data = array ();
$isFunctionPolicies = enterprise_include_once ('include/functions_policies.php'); $isFunctionPolicies = enterprise_include_once ('include/functions_policies.php');
if ($agent_w)
$table->head[0] = "<span title='" . __('Force execution') . "'>" . __('F.') . "</span>"; $table->head[0] = "<span title='" . __('Force execution') . "'>" . __('F.') . "</span>";
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
$table->head[1] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>"; $table->head[1] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>";
@ -744,17 +744,19 @@ if ($list_modules) {
$data = array (); $data = array ();
if (($module["id_modulo"] != 1) && ($module["id_tipo_modulo"] != 100)) { if (($module["id_modulo"] != 1) && ($module["id_tipo_modulo"] != 100)) {
if ($module["flag"] == 0) { if ($agent_w) {
$data[0] = '<a href="index.php?' . if ($module["flag"] == 0) {
'sec=estado&amp;' . $data[0] = '<a href="index.php?' .
'sec2=operation/agentes/ver_agente&amp;' . 'sec=estado&amp;' .
'id_agente=' . $id_agente . '&amp;' . 'sec2=operation/agentes/ver_agente&amp;' .
'id_agente_modulo=' . $module["id_agente_modulo"] . '&amp;' . 'id_agente=' . $id_agente . '&amp;' .
'flag=1&amp;' . 'id_agente_modulo=' . $module["id_agente_modulo"] . '&amp;' .
'refr=60">' . html_print_image("images/target.png", true, array("border" => '0', "title" => __('Force'))) . '</a>'; 'flag=1&amp;' .
} 'refr=60">' . html_print_image("images/target.png", true, array("border" => '0', "title" => __('Force'))) . '</a>';
else { }
$data[0] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente.'&amp;id_agente_modulo='.$module["id_agente_modulo"].'&amp;refr=60">' . html_print_image("images/refresh.png", true, array("border" => "0", "title" => __("Refresh"))) . '</a>'; else {
$data[0] = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente.'&amp;id_agente_modulo='.$module["id_agente_modulo"].'&amp;refr=60">' . html_print_image("images/refresh.png", true, array("border" => "0", "title" => __("Refresh"))) . '</a>';
}
} }
} }
else { else {

View File

@ -816,13 +816,15 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
if (!defined('METACONSOLE')) { if (!defined('METACONSOLE')) {
// Force alert execution // Force alert execution
$data[$index['force_execution']] = ''; $data[$index['force_execution']] = '';
if ($alert["force_execution"] == 0) { if (check_acl ($config["id_user"], $id_group, "AW") || check_acl ($config["id_user"], $id_group, "LM")) {
$data[$index['force_execution']] = if ($alert["force_execution"] == 0) {
'<a href="'.$url.'&amp;id_alert='.$alert["id"].'&amp;force_execution=1&refr=60">' . html_print_image("images/target.png", true, array("border" => '0', "title" => __('Force'))) . '</a>'; $data[$index['force_execution']] =
} '<a href="'.$url.'&amp;id_alert='.$alert["id"].'&amp;force_execution=1&refr=60">' . html_print_image("images/target.png", true, array("border" => '0', "title" => __('Force'))) . '</a>';
else { }
$data[$index['force_execution']] = else {
'<a href="'.$url.'&amp;id_alert='.$alert["id"].'&amp;refr=60">' . html_print_image("images/refresh.png", true) . '</a>'; $data[$index['force_execution']] =
'<a href="'.$url.'&amp;id_alert='.$alert["id"].'&amp;refr=60">' . html_print_image("images/refresh.png", true) . '</a>';
}
} }
} }
@ -2416,7 +2418,7 @@ function ui_print_page_header ($title, $icon = "", $return = false, $help = "",
$buffer .= '<ul class="mn"><li class="' . $type . '">&nbsp;' . '&nbsp; '; $buffer .= '<ul class="mn"><li class="' . $type . '">&nbsp;' . '&nbsp; ';
$buffer .= '<span style="margin-right:10px;">' . $buffer .= '<span style="margin-right:10px;">' .
ui_print_truncate_text($title, 46); ui_print_truncate_text($title, 'item_title');
if ($modal && !enterprise_installed()){ if ($modal && !enterprise_installed()){
$buffer .= " $buffer .= "
<div id='".$message."' class='publienterprise' title='Community version' style='float: right;margin-top: -2px !important; margin-left: 2px !important;'><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div> <div id='".$message."' class='publienterprise' title='Community version' style='float: right;margin-top: -2px !important; margin-left: 2px !important;'><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>

View File

@ -417,9 +417,11 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
__('S.') . "</span>"; __('S.') . "</span>";
if (!is_metaconsole()) { if (!is_metaconsole()) {
$table->head[2] = if (check_acl($config['id_user'], $id_group, "AW") || check_acl($config['id_user'], $id_group, "LM")) {
"<span title='" . __('Force execution') . "'>" . $table->head[2] =
__('F.') . "</span>"; "<span title='" . __('Force execution') . "'>" .
__('F.') . "</span>";
}
} }
$table->head[3] = __('Agent'); $table->head[3] = __('Agent');
@ -460,7 +462,8 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
$table->head[1] = "<span title='" . __('Standby') . "'>" . __('S.') . "</span>"; $table->head[1] = "<span title='" . __('Standby') . "'>" . __('S.') . "</span>";
if (!is_metaconsole()) { if (!is_metaconsole()) {
$table->head[2] = "<span title='" . __('Force execution') . "'>" . __('F.') . "</span>"; if (check_acl($config['id_user'], $id_group, "AW") || check_acl ($config["id_user"], $id_group, "LM"))
$table->head[2] = "<span title='" . __('Force execution') . "'>" . __('F.') . "</span>";
} }
$table->head[3] = __('Module'); $table->head[3] = __('Module');
@ -493,7 +496,8 @@ else {
if ($print_agent) { if ($print_agent) {
$table->head[0] = "<span title='" . __('Standby') . "'>" . __('S.') . "</span>"; $table->head[0] = "<span title='" . __('Standby') . "'>" . __('S.') . "</span>";
if (!is_metaconsole()) { if (!is_metaconsole()) {
$table->head[1] = "<span title='" . __('Force execution') . "'>" . __('F.') . "</span>"; if (check_acl($config['id_user'], $id_group, "AW") || check_acl ($config["id_user"], $id_group, "LM"))
$table->head[1] = "<span title='" . __('Force execution') . "'>" . __('F.') . "</span>";
} }
$table->head[2] = __('Agent'); $table->head[2] = __('Agent');
$table->head[3] = __('Module'); $table->head[3] = __('Module');
@ -527,7 +531,8 @@ else {
else { else {
$table->head[0] = "<span title='" . __('Standby') . "'>" . __('S.') . "</span>"; $table->head[0] = "<span title='" . __('Standby') . "'>" . __('S.') . "</span>";
if (!is_metaconsole()) { if (!is_metaconsole()) {
$table->head[1] = "<span title='" . __('Force execution') . "'>" . __('F.') . "</span>"; if (check_acl($config['id_user'], $id_group, "AW") || check_acl ($config["id_user"], $id_group, "LM"))
$table->head[1] = "<span title='" . __('Force execution') . "'>" . __('F.') . "</span>";
} }
$table->head[2] = __('Module'); $table->head[2] = __('Module');
$table->head[3] = __('Template'); $table->head[3] = __('Template');

View File

@ -616,7 +616,8 @@ $table->rowspan[1][0] = 0;
$data[0][2] = '<div style="width:100%; text-align:right">'; $data[0][2] = '<div style="width:100%; text-align:right">';
$data[0][2] .= '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente.'&amp;refr=60">' . html_print_image("images/refresh.png", true, array("border" => '0', "title" => __('Refresh data'), "alt" => "")) . '</a><br>'; $data[0][2] .= '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente.'&amp;refr=60">' . html_print_image("images/refresh.png", true, array("border" => '0', "title" => __('Refresh data'), "alt" => "")) . '</a><br>';
$data[0][2] .= '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;flag_agent=1&amp;id_agente='.$id_agente.'">' . html_print_image("images/target.png", true, array("border" => '0', "title" => __('Force'), "alt" => "")) . '</a>'; if (check_acl ($config["id_user"], $agent["id_grupo"], "AW"))
$data[0][2] .= '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;flag_agent=1&amp;id_agente='.$id_agente.'">' . html_print_image("images/target.png", true, array("border" => '0', "title" => __('Force'), "alt" => "")) . '</a>';
$data[0][2] .= '</div>'; $data[0][2] .= '</div>';
$table->data = $data; $table->data = $data;