Merge branch 'ent-3866-7901-bug-en-busqueda-general-usuario-con-grupo-asignado' into 'develop'
Added secondary groups in global search See merge request artica/pandorafms!2351 Former-commit-id: c9202c576699e7cd4df19e5d7a28bda5fc36826c
This commit is contained in:
commit
545afcb684
|
@ -9340,15 +9340,34 @@ function reporting_get_agent_module_info($id_agent)
|
||||||
|
|
||||||
$return = [];
|
$return = [];
|
||||||
$return['last_contact'] = 0;
|
$return['last_contact'] = 0;
|
||||||
// Last agent contact
|
// Last agent contact.
|
||||||
$return['status'] = STATUS_AGENT_NO_DATA;
|
$return['status'] = STATUS_AGENT_NO_DATA;
|
||||||
$return['status_img'] = ui_print_status_image(STATUS_AGENT_NO_DATA, __('Agent without data'), true);
|
$return['status_img'] = ui_print_status_image(
|
||||||
|
STATUS_AGENT_NO_DATA,
|
||||||
|
__('Agent without data'),
|
||||||
|
true
|
||||||
|
);
|
||||||
$return['alert_status'] = 'notfired';
|
$return['alert_status'] = 'notfired';
|
||||||
$return['alert_value'] = STATUS_ALERT_NOT_FIRED;
|
$return['alert_value'] = STATUS_ALERT_NOT_FIRED;
|
||||||
$return['alert_img'] = ui_print_status_image(STATUS_ALERT_NOT_FIRED, __('Alert not fired'), true);
|
$return['alert_img'] = ui_print_status_image(
|
||||||
$return['agent_group'] = agents_get_agent_group($id_agent);
|
STATUS_ALERT_NOT_FIRED,
|
||||||
|
__('Alert not fired'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
if (!check_acl($config['id_user'], $return['agent_group'], 'AR')) {
|
$return['agent_group'] = '';
|
||||||
|
// Important agents_get_all_groups_agent check secondary groups.
|
||||||
|
$id_all_groups = agents_get_all_groups_agent($id_agent);
|
||||||
|
if (isset($id_all_groups) && is_array($id_all_groups)) {
|
||||||
|
foreach ($id_all_groups as $value) {
|
||||||
|
if (check_acl($config['id_user'], $value, 'AR')) {
|
||||||
|
$return['agent_group'] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If $return['agent_group'] is empty no access.
|
||||||
|
if ($return['agent_group'] == '') {
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9361,7 +9380,7 @@ function reporting_get_agent_module_info($id_agent)
|
||||||
|
|
||||||
$now = get_system_time();
|
$now = get_system_time();
|
||||||
|
|
||||||
// Get modules status for this agent
|
// Get modules status for this agent.
|
||||||
$agent = db_get_row('tagente', 'id_agente', $id_agent);
|
$agent = db_get_row('tagente', 'id_agente', $id_agent);
|
||||||
|
|
||||||
$return['total_count'] = $agent['total_count'];
|
$return['total_count'] = $agent['total_count'];
|
||||||
|
@ -9375,28 +9394,52 @@ function reporting_get_agent_module_info($id_agent)
|
||||||
if ($return['total_count'] > 0) {
|
if ($return['total_count'] > 0) {
|
||||||
if ($return['critical_count'] > 0) {
|
if ($return['critical_count'] > 0) {
|
||||||
$return['status'] = STATUS_AGENT_CRITICAL;
|
$return['status'] = STATUS_AGENT_CRITICAL;
|
||||||
$return['status_img'] = ui_print_status_image(STATUS_AGENT_CRITICAL, __('At least one module in CRITICAL status'), true);
|
$return['status_img'] = ui_print_status_image(
|
||||||
|
STATUS_AGENT_CRITICAL,
|
||||||
|
__('At least one module in CRITICAL status'),
|
||||||
|
true
|
||||||
|
);
|
||||||
} else if ($return['warning_count'] > 0) {
|
} else if ($return['warning_count'] > 0) {
|
||||||
$return['status'] = STATUS_AGENT_WARNING;
|
$return['status'] = STATUS_AGENT_WARNING;
|
||||||
$return['status_img'] = ui_print_status_image(STATUS_AGENT_WARNING, __('At least one module in WARNING status'), true);
|
$return['status_img'] = ui_print_status_image(
|
||||||
|
STATUS_AGENT_WARNING,
|
||||||
|
__('At least one module in WARNING status'),
|
||||||
|
true
|
||||||
|
);
|
||||||
} else if ($return['unknown_count'] > 0) {
|
} else if ($return['unknown_count'] > 0) {
|
||||||
$return['status'] = STATUS_AGENT_DOWN;
|
$return['status'] = STATUS_AGENT_DOWN;
|
||||||
$return['status_img'] = ui_print_status_image(STATUS_AGENT_DOWN, __('At least one module is in UKNOWN status'), true);
|
$return['status_img'] = ui_print_status_image(
|
||||||
|
STATUS_AGENT_DOWN,
|
||||||
|
__('At least one module is in UKNOWN status'),
|
||||||
|
true
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$return['status'] = STATUS_AGENT_OK;
|
$return['status'] = STATUS_AGENT_OK;
|
||||||
$return['status_img'] = ui_print_status_image(STATUS_AGENT_OK, __('All Monitors OK'), true);
|
$return['status_img'] = ui_print_status_image(
|
||||||
|
STATUS_AGENT_OK,
|
||||||
|
__('All Monitors OK'),
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alert not fired is by default
|
// Alert not fired is by default.
|
||||||
if ($return['fired_count'] > 0) {
|
if ($return['fired_count'] > 0) {
|
||||||
$return['alert_status'] = 'fired';
|
$return['alert_status'] = 'fired';
|
||||||
$return['alert_img'] = ui_print_status_image(STATUS_ALERT_FIRED, __('Alert fired'), true);
|
$return['alert_img'] = ui_print_status_image(
|
||||||
|
STATUS_ALERT_FIRED,
|
||||||
|
__('Alert fired'),
|
||||||
|
true
|
||||||
|
);
|
||||||
$return['alert_value'] = STATUS_ALERT_FIRED;
|
$return['alert_value'] = STATUS_ALERT_FIRED;
|
||||||
} else if (groups_give_disabled_group($return['agent_group'])) {
|
} else if (groups_give_disabled_group($return['agent_group'])) {
|
||||||
$return['alert_status'] = 'disabled';
|
$return['alert_status'] = 'disabled';
|
||||||
$return['alert_value'] = STATUS_ALERT_DISABLED;
|
$return['alert_value'] = STATUS_ALERT_DISABLED;
|
||||||
$return['alert_img'] = ui_print_status_image(STATUS_ALERT_DISABLED, __('Alert disabled'), true);
|
$return['alert_img'] = ui_print_status_image(
|
||||||
|
STATUS_ALERT_DISABLED,
|
||||||
|
__('Alert disabled'),
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
|
|
|
@ -182,7 +182,8 @@ if ($searchAgents) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
FROM tagente t1
|
FROM tagente t1 LEFT JOIN tagent_secondary_group tasg
|
||||||
|
ON t1.id_agente = tasg.id_agent
|
||||||
INNER JOIN tgrupo t2
|
INNER JOIN tgrupo t2
|
||||||
ON t2.id_grupo = t1.id_grupo
|
ON t2.id_grupo = t1.id_grupo
|
||||||
WHERE (
|
WHERE (
|
||||||
|
@ -191,9 +192,11 @@ if ($searchAgents) {
|
||||||
FROM tusuario
|
FROM tusuario
|
||||||
WHERE id_user = '".$config['id_user']."'
|
WHERE id_user = '".$config['id_user']."'
|
||||||
)
|
)
|
||||||
OR t1.id_grupo IN (
|
OR (
|
||||||
".implode(',', $id_userGroups)."
|
t1.id_grupo IN (".implode(',', $id_userGroups).')
|
||||||
) OR 0 IN (
|
OR tasg.id_group IN ('.implode(',', $id_userGroups).")
|
||||||
|
)
|
||||||
|
OR 0 IN (
|
||||||
SELECT id_grupo
|
SELECT id_grupo
|
||||||
FROM tusuario_perfil
|
FROM tusuario_perfil
|
||||||
WHERE id_usuario = '".$config['id_user']."'
|
WHERE id_usuario = '".$config['id_user']."'
|
||||||
|
@ -208,7 +211,7 @@ if ($searchAgents) {
|
||||||
)
|
)
|
||||||
';
|
';
|
||||||
|
|
||||||
$select = 'SELECT t1.id_agente, t1.ultimo_contacto, t1.nombre, t1.id_os, t1.intervalo, t1.id_grupo, t1.disabled, t1.alias, t1.quiet';
|
$select = 'SELECT DISTINCT(t1.id_agente), t1.ultimo_contacto, t1.nombre, t1.id_os, t1.intervalo, t1.id_grupo, t1.disabled, t1.alias, t1.quiet';
|
||||||
if ($only_count) {
|
if ($only_count) {
|
||||||
$limit = ' ORDER BY '.$order['field'].' '.$order['order'].' LIMIT '.$config['block_size'].' OFFSET 0';
|
$limit = ' ORDER BY '.$order['field'].' '.$order['order'].' LIMIT '.$config['block_size'].' OFFSET 0';
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue