Fixed problem with strict acl

This commit is contained in:
Arturo Gonzalez 2016-03-01 15:45:58 +01:00
parent 3840cf6698
commit 2d8ec851af
1 changed files with 130 additions and 187 deletions

View File

@ -247,35 +247,7 @@ function groupview_get_all_data ($id_user = false, $user_strict = false, $acltag
$list["_server_sanity_"] = format_numeric (100 - $list["_module_sanity_"], 1);
}
else {
if ($user_strict) {
$fields = array ('tagente.id_agente','tagente.id_grupo','tagente.id_os','tagente.ultimo_contacto','tagente.intervalo','tagente.comentarios description','tagente.quiet',
'tagente.normal_count','tagente.warning_count','tagente.critical_count','tagente.unknown_count','tagente.notinit_count','tagente.total_count','tagente.fired_count');
$acltags = tags_get_user_module_and_tags ($config['id_user'], 'AR', $strict_user);
$total_agents = tags_get_all_user_agents (false, $config['id_user'], $acltags, $count_filter, $fields, false, $strict_user, true);
$total_agents = count($total_agents);
$agents = tags_get_all_user_agents (false, $config['id_user'], $acltags, $filter, $fields, false, $strict_user, true);
foreach ($agents as $agent) {
$list[$agent['id_grupo']]['_monitors_ok_'] += (int)$agent['normal_count'];
$list[$agent['id_grupo']]['_monitors_critical_'] += (int)$agent['critical_count'];
$list[$agent['id_grupo']]['_monitors_warning_'] += (int)$agent['warning_count'];
$list[$agent['id_grupo']]['_monitors_unknown_'] += (int)$agent['unknown_count'];
$list[$agent['id_grupo']]['_monitors_not_init_'] += (int)$agent['notinit_count'];
$list[$agent['id_grupo']]['_monitors_alerts_fired_'] += (int)$agent['fired_count'];
$list[$agent['id_grupo']]['_total_agents_'] += 1;
if (($agent['normal_count'] == 0) && ($agent['critical_count'] == 0) &&
($agent['warning_count'] == 0) && ($agent['unknown_count'] != 0)) {
$list[$agent['id_grupo']]['_agents_unknown_'] += 1;
}
if (($agent['normal_count'] == 0) && ($agent['critical_count'] == 0) &&
($agent['warning_count'] == 0) && ($agent['unknown_count'] == 0)) {
$list[$agent['id_grupo']]['_agents_not_init_'] += 1;
}
}
}
else {
else if (!$user_strict) {
foreach ($list_groups as $group) {
$agent_not_init = agents_get_agents(array (
'disabled' => 0,
@ -350,7 +322,7 @@ function groupview_get_all_data ($id_user = false, $user_strict = false, $acltag
GROUP BY estado");
$list[$group['id_grupo']]['_monitors_not_init_'] = isset ($result_not_init['contado']) ? $result_not_init['contado'] : 0;
}
}
if ($user_strict) {
$i = 1;
foreach ($user_tags as $group_id => $tag_name) {
@ -883,35 +855,7 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
$list["_server_sanity_"] = format_numeric (100 - $list["_module_sanity_"], 1);
}
else {
if ($user_strict) {
$fields = array ('tagente.id_agente','tagente.id_grupo','tagente.id_os','tagente.ultimo_contacto','tagente.intervalo','tagente.comentarios description','tagente.quiet',
'tagente.normal_count','tagente.warning_count','tagente.critical_count','tagente.unknown_count','tagente.notinit_count','tagente.total_count','tagente.fired_count');
$acltags = tags_get_user_module_and_tags ($config['id_user'], 'AR', $strict_user);
$total_agents = tags_get_all_user_agents (false, $config['id_user'], $acltags, $count_filter, $fields, false, $strict_user, true);
$total_agents = count($total_agents);
$agents = tags_get_all_user_agents (false, $config['id_user'], $acltags, $filter, $fields, false, $strict_user, true);
foreach ($agents as $agent) {
$list[$agent['id_grupo']]['_monitors_ok_'] += (int)$agent['normal_count'];
$list[$agent['id_grupo']]['_monitors_critical_'] += (int)$agent['critical_count'];
$list[$agent['id_grupo']]['_monitors_warning_'] += (int)$agent['warning_count'];
$list[$agent['id_grupo']]['_monitors_unknown_'] += (int)$agent['unknown_count'];
$list[$agent['id_grupo']]['_monitors_not_init_'] += (int)$agent['notinit_count'];
$list[$agent['id_grupo']]['_monitors_alerts_fired_'] += (int)$agent['fired_count'];
$list[$agent['id_grupo']]['_total_agents_'] += 1;
if (($agent['normal_count'] == 0) && ($agent['critical_count'] == 0) &&
($agent['warning_count'] == 0) && ($agent['unknown_count'] != 0)) {
$list[$agent['id_grupo']]['_agents_unknown_'] += 1;
}
if (($agent['normal_count'] == 0) && ($agent['critical_count'] == 0) &&
($agent['warning_count'] == 0) && ($agent['unknown_count'] == 0)) {
$list[$agent['id_grupo']]['_agents_not_init_'] += 1;
}
}
}
else {
else if (!$user_strict) {
foreach ($list_groups as $group) {
$agent_not_init = agents_get_agents(array (
'disabled' => 0,
@ -989,7 +933,6 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
$list[$group['id_grupo']]['_monitors_not_init_'] = isset ($result_not_init['contado']) ? $result_not_init['contado'] : 0;
}
}
}
if ($user_strict) {
$i = 1;