[Secondary groups] Fixed display only secondary agents in tree view

This commit is contained in:
fermin831 2018-04-09 15:13:01 +02:00
parent f8d900ee75
commit 29a4e29cb9
1 changed files with 14 additions and 29 deletions

View File

@ -315,39 +315,24 @@ class Tree {
// ACL Group // ACL Group
$user_groups_str = "-1"; $user_groups_str = "-1";
$group_filter = ""; $group_filter = "";
if (!$this->strictACL) {
if (empty($this->userGroups)) { if (empty($this->userGroups)) {
return;
}
// Asking for a specific group.
if ($item_for_count !== false) {
if (!isset($this->userGroups[$item_for_count])) {
return; return;
} }
// Asking for a specific group.
if ($item_for_count !== false) {
if (!isset($this->userGroups[$item_for_count])) {
return;
}
}
// Asking for all groups.
else {
$user_groups_str = implode(",", array_keys($this->userGroups));
$group_filter = "AND ta.id_grupo IN ($user_groups_str)";
}
} }
// Asking for all groups.
else { else {
if (!empty($this->acltags)) { $user_groups_str = implode(",", array_keys($this->userGroups));
$groups = array(); $group_filter = "AND (
foreach ($this->acltags as $group_id => $tags_str) { ta.id_grupo IN ($user_groups_str)
if (empty($tags_str)) { OR tasg.id_group IN ($user_groups_str)
$hierarchy_groups = groups_get_id_recursive($group_id); )";
$groups = array_merge($groups, $hierarchy_groups);
}
}
if (!empty($groups)) {
if (array_search(0, $groups) === false) {
$user_groups_str = implode(",", $groups);
}
}
}
$group_filter = "AND ta.id_grupo IN ($user_groups_str)";
} }
if(!$search_hirearchy && (!empty($agent_search_filter) || !empty($module_search_filter))){ if(!$search_hirearchy && (!empty($agent_search_filter) || !empty($module_search_filter))){