mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
fixed errors in policies metaconsole
This commit is contained in:
parent
fb73a0b8b2
commit
3985316a9b
@ -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()){
|
||||||
|
$node = metaconsole_get_connection_by_id($alert['server_data']['id']);
|
||||||
|
if (metaconsole_load_external_db($node) !== NOERR) {
|
||||||
|
// Restore the default connection.
|
||||||
|
metaconsole_restore_db();
|
||||||
|
$errors++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$policyInfo = policies_is_alert_in_policy2($alert['id'], false);
|
$policyInfo = policies_is_alert_in_policy2($alert['id'], false);
|
||||||
if ($policyInfo === false)
|
if ($policyInfo === false)
|
||||||
$data[$index['policy']] = '';
|
$data[$index['policy']] = '';
|
||||||
else {
|
else {
|
||||||
$img = 'images/policies.png';
|
$img = 'images/policies.png';
|
||||||
|
if(!is_metaconsole()){
|
||||||
$data[$index['policy']] = '<a href="?sec=gmodules&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo['id'] . '">' .
|
$data[$index['policy']] = '<a href="?sec=gmodules&sec2=enterprise/godmode/policies/policies&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&sec2=advanced/policymanager&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, '[…]', 'font-size:7.5pt;');
|
$data[$index['agent_name']] = ui_print_truncate_text($agent_name, 'agent_small', false, true, false, '[…]', 'font-size:7.5pt;');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -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>";
|
||||||
|
|
||||||
|
@ -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,13 +1085,23 @@ if (!empty($result)) {
|
|||||||
$title = __('(Unlinked) ') . $policyInfo['name_policy'];
|
$title = __('(Unlinked) ') . $policyInfo['name_policy'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(is_metaconsole()){
|
||||||
|
$data[0] = '<a href="?sec=gmodules&sec2=advanced/policymanager&id=' . $policyInfo['id_policy'] . '">' .
|
||||||
|
html_print_image($img,true, array('title' => $title)) .
|
||||||
|
'</a>';
|
||||||
|
}
|
||||||
|
else{
|
||||||
$data[0] = '<a href="?sec=gmodules&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo['id_policy'] . '">' .
|
$data[0] = '<a href="?sec=gmodules&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo['id_policy'] . '">' .
|
||||||
html_print_image($img,true, array('title' => $title)) .
|
html_print_image($img,true, array('title' => $title)) .
|
||||||
'</a>';
|
'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(is_metaconsole()){
|
||||||
|
metaconsole_restore_db();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$agent_alias = !empty($row['agent_alias']) ? $row['agent_alias'] : $row['agent_name'];
|
$agent_alias = !empty($row['agent_alias']) ? $row['agent_alias'] : $row['agent_name'];
|
||||||
|
|
||||||
// TODO: Calculate hash access before to use it more simply like other sections. I.E. Events view
|
// TODO: Calculate hash access before to use it more simply like other sections. I.E. Events view
|
||||||
|
Loading…
x
Reference in New Issue
Block a user