Fixed the tactical with empty (in acl) users. TICKET: #3148

This commit is contained in:
mdtrooper 2016-01-22 13:10:45 +01:00
parent eef2101651
commit a1c28937bd

View File

@ -38,6 +38,10 @@ function tactical_get_data ($id_user = false, $user_strict = false, $acltags, $r
$user_groups_ids = implode(',', array_keys($acltags));
}
if (empty($user_groups_ids)) {
$user_groups_ids = 'null';
}
if (!empty($user_groups_ids)) {
switch ($config["dbtype"]) {
case "mysql":
@ -70,7 +74,9 @@ function tactical_get_data ($id_user = false, $user_strict = false, $acltags, $r
$list['_monitors_unknown_'] = 0;
$list['_monitors_not_init_'] = 0;
$list['_monitors_ok_'] = 0;
if ($list_groups == false) {
if (empty($list_groups)) {
$list_groups = array();
}
@ -299,6 +305,7 @@ function tactical_get_data ($id_user = false, $user_strict = false, $acltags, $r
}
else {
if ($user_strict) {
$_tag_condition = 'AND ' . tags_get_acl_tags_module_condition($acltags,'tae');
}
@ -316,6 +323,9 @@ function tactical_get_data ($id_user = false, $user_strict = false, $acltags, $r
$_tag_condition
GROUP BY estado");
if (empty($result_list))
$result_list = array();
foreach ($result_list as $result) {
switch ($result['estado']) {
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
@ -418,7 +428,8 @@ function tactical_status_modules_agents($id_user = false, $user_strict = false,
else {
$result_list = tactical_get_data ($id_user, $user_strict,
$acltags);
$acltags);
return $result_list;
}
}
@ -429,7 +440,6 @@ function tactical_monitor_alerts ($group_array, $strict_user = false, $id_group_
if (empty ($group_array)) {
return 0;
}
else if (!is_array ($group_array)) {
$group_array = array($group_array);
@ -448,7 +458,8 @@ function tactical_monitor_alerts ($group_array, $strict_user = false, $id_group_
AND talert_template_modules.id_agent_module = tagente_modulo.id_agente_modulo";
$count = db_get_sql ($sql);
return $count;
} else {
}
else {
//TODO REVIEW ORACLE AND POSTGRES
return db_get_sql ("SELECT COUNT(talert_template_modules.id)
FROM talert_template_modules, tagente_modulo, tagente_estado, tagente
@ -464,7 +475,6 @@ function tactical_monitor_fired_alerts ($group_array, $strict_user = false, $id_
if (empty ($group_array)) {
return 0;
}
else if (!is_array ($group_array)) {
$group_array = array($group_array);
@ -486,7 +496,8 @@ function tactical_monitor_fired_alerts ($group_array, $strict_user = false, $id_
$count = db_get_sql ($sql);
return $count;
} else {
}
else {
//TODO REVIEW ORACLE AND POSTGRES
return db_get_sql ("SELECT COUNT(talert_template_modules.id)
FROM talert_template_modules, tagente_modulo, tagente_estado, tagente
@ -497,6 +508,4 @@ function tactical_monitor_fired_alerts ($group_array, $strict_user = false, $id_
}
}
?>