Merge branch '2076-Mejoras_en_gestion_de_politicas_desde_Metaconsola_3' into 'develop'

fixed errors in policies metaconsole

See merge request artica/pandorafms!1635
This commit is contained in:
vgilc 2018-07-26 15:09:28 +02:00
commit ab900f1e54
3 changed files with 72 additions and 38 deletions

View File

@ -832,19 +832,36 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
$data = array (); $data = array ();
if (!defined('METACONSOLE')) { if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { if(is_metaconsole()){
$policyInfo = policies_is_alert_in_policy2($alert['id'], false); $node = metaconsole_get_connection_by_id($alert['server_data']['id']);
if ($policyInfo === false) if (metaconsole_load_external_db($node) !== NOERR) {
$data[$index['policy']] = ''; // Restore the default connection.
else { metaconsole_restore_db();
$img = 'images/policies.png'; $errors++;
break;
}
}
$policyInfo = policies_is_alert_in_policy2($alert['id'], false);
if ($policyInfo === false)
$data[$index['policy']] = '';
else {
$img = 'images/policies.png';
if(!is_metaconsole()){
$data[$index['policy']] = '<a href="?sec=gmodules&amp;sec2=enterprise/godmode/policies/policies&amp;id=' . $policyInfo['id'] . '">' . $data[$index['policy']] = '<a href="?sec=gmodules&amp;sec2=enterprise/godmode/policies/policies&amp;id=' . $policyInfo['id'] . '">' .
html_print_image($img,true, array('title' => $policyInfo['name'])) . html_print_image($img,true, array('title' => $policyInfo['name'])) .
'</a>'; '</a>';
}else{
$data[$index['policy']] = '<a href="?sec=gmodules&amp;sec2=advanced/policymanager&amp;id=' . $policyInfo['id'] . '">' .
html_print_image($img,true, array('title' => $policyInfo['name'])) .
'</a>';
} }
} }
if(is_metaconsole()){
metaconsole_restore_db();
}
} }
// Standby // Standby
@ -882,7 +899,7 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
$id_agent = modules_get_agentmodule_agent ($alert["id_agent_module"]); $id_agent = modules_get_agentmodule_agent ($alert["id_agent_module"]);
} }
if (defined('METACONSOLE') && !can_user_access_node ()) { if (defined('METACONSOLE') || !can_user_access_node ()) {
$data[$index['agent_name']] = ui_print_truncate_text($agent_name, 'agent_small', false, true, false, '[&hellip;]', 'font-size:7.5pt;'); $data[$index['agent_name']] = ui_print_truncate_text($agent_name, 'agent_small', false, true, false, '[&hellip;]', 'font-size:7.5pt;');
} }
else { else {

View File

@ -449,10 +449,8 @@ $table->align = array ();
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
if ($print_agent) { if ($print_agent) {
if (!is_metaconsole()) {
$table->head[0] = "<span title='" . __('Policy') . "'>" . $table->head[0] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>";
__('P.') . "</span>";
}
$table->head[1] = "<span title='" . __('Standby') . "'>" . $table->head[1] = "<span title='" . __('Standby') . "'>" .
__('S.') . "</span>"; __('S.') . "</span>";
@ -496,9 +494,7 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
} }
} }
else { else {
if (!is_metaconsole()) { $table->head[0] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>";
$table->head[0] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>";
}
$table->head[1] = "<span title='" . __('Standby') . "'>" . __('S.') . "</span>"; $table->head[1] = "<span title='" . __('Standby') . "'>" . __('S.') . "</span>";

View File

@ -984,7 +984,7 @@ if (!empty($result)) {
$table->head[3] .= ' <a href="index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=module_name&amp;sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectModuleNameUp, 'alt' => 'up')) . '</a>' . $table->head[3] .= ' <a href="index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=module_name&amp;sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectModuleNameUp, 'alt' => 'up')) . '</a>' .
'<a href="index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=module_name&amp;sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectModuleNameDown, 'alt' => 'down')) . '</a>'; '<a href="index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=module_name&amp;sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectModuleNameDown, 'alt' => 'down')) . '</a>';
$table->head[4] = __('Server type'); $table->head[4] = __('Server type');
$table->head[4] .= ' <a href="index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=moduletype&amp;sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectModuleNameUp, 'alt' => 'up')) . '</a>' . $table->head[4] .= ' <a href="index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=moduletype&amp;sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectModuleNameUp, 'alt' => 'up')) . '</a>' .
'<a href="index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=moduletype&amp;sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectModuleNameDown, 'alt' => 'down')) . '</a>'; '<a href="index.php?sec=view&amp;sec2=operation/agentes/status_monitor&amp;datatype='.$datatype . '&amp;moduletype='.$moduletype . '&amp;refr=' . $refr . '&amp;modulegroup='.$modulegroup . '&amp;offset=' . $offset . '&amp;ag_group=' . $ag_group . '&amp;ag_freestring=' . $ag_freestring . '&amp;ag_modulename=' . $ag_modulename . '&amp;status=' . $status . $ag_custom_fields_params . '&amp;sort_field=moduletype&amp;sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectModuleNameDown, 'alt' => 'down')) . '</a>';
@ -1043,7 +1043,18 @@ if (!empty($result)) {
$data = array (); $data = array ();
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
if(is_metaconsole()){
$node = metaconsole_get_connection_by_id($row['server_id']);
if (metaconsole_load_external_db($node) !== NOERR) {
// Restore the default connection.
metaconsole_restore_db();
$errors++;
break;
}
}
$policyInfo = policies_info_module_policy($row['id_agente_modulo']); $policyInfo = policies_info_module_policy($row['id_agente_modulo']);
if ($policyInfo === false) if ($policyInfo === false)
$data[0] = ''; $data[0] = '';
else { else {
@ -1074,10 +1085,20 @@ if (!empty($result)) {
$title = __('(Unlinked) ') . $policyInfo['name_policy']; $title = __('(Unlinked) ') . $policyInfo['name_policy'];
} }
} }
if(is_metaconsole()){
$data[0] = '<a href="?sec=gmodules&amp;sec2=advanced/policymanager&amp;id=' . $policyInfo['id_policy'] . '">' .
html_print_image($img,true, array('title' => $title)) .
'</a>';
}
else{
$data[0] = '<a href="?sec=gmodules&amp;sec2=enterprise/godmode/policies/policies&amp;id=' . $policyInfo['id_policy'] . '">' .
html_print_image($img,true, array('title' => $title)) .
'</a>';
}
}
$data[0] = '<a href="?sec=gmodules&amp;sec2=enterprise/godmode/policies/policies&amp;id=' . $policyInfo['id_policy'] . '">' . if(is_metaconsole()){
html_print_image($img,true, array('title' => $title)) . metaconsole_restore_db();
'</a>';
} }
} }