mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
fixed error in acl groups tree view
This commit is contained in:
parent
59e405c2b3
commit
90d686a7ab
@ -1253,7 +1253,7 @@ class Tree {
|
|||||||
// If user have not permissions in parent, set parent node to 0 (all)
|
// If user have not permissions in parent, set parent node to 0 (all)
|
||||||
// TODO avoid to do foreach for admins
|
// TODO avoid to do foreach for admins
|
||||||
foreach ($groups as $id => $group) {
|
foreach ($groups as $id => $group) {
|
||||||
if (!in_array($groups[$id]['parent'], $this->userGroupsArray)) {
|
if (!isset($this->userGroups[$groups[$id]['parent']])) {
|
||||||
$groups[$id]['parent'] = 0;
|
$groups[$id]['parent'] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2583,6 +2583,14 @@ class Tree {
|
|||||||
$filters['module_search_condition'] = " AND tam.disabled = 0 AND tam.nombre LIKE '%" . $this->filter['searchModule'] . "%' " . $this->getModuleStatusFilterFromTestado();
|
$filters['module_search_condition'] = " AND tam.disabled = 0 AND tam.nombre LIKE '%" . $this->filter['searchModule'] . "%' " . $this->getModuleStatusFilterFromTestado();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$group_acl = "";
|
||||||
|
$secondary_group_acl = "";
|
||||||
|
if (!users_can_manage_group_all("AR")) {
|
||||||
|
$user_groups_str = implode(",", $this->userGroupsArray);
|
||||||
|
$group_acl = " AND ta.id_grupo IN ($user_groups_str)";
|
||||||
|
$secondary_group_acl = " AND tasg.id_group IN ($user_groups_str)";
|
||||||
|
}
|
||||||
|
|
||||||
$table = is_metaconsole() ? "tmetaconsole_agent" : "tagente";
|
$table = is_metaconsole() ? "tmetaconsole_agent" : "tagente";
|
||||||
$table_sec = is_metaconsole() ? "tmetaconsole_agent_secondary_group" : "tagent_secondary_group";
|
$table_sec = is_metaconsole() ? "tmetaconsole_agent_secondary_group" : "tagent_secondary_group";
|
||||||
$sql_model = "SELECT %s FROM
|
$sql_model = "SELECT %s FROM
|
||||||
@ -2592,14 +2600,16 @@ class Tree {
|
|||||||
ON ta.id_agente = tasg.id_agent
|
ON ta.id_agente = tasg.id_agent
|
||||||
%s
|
%s
|
||||||
WHERE ta.disabled = 0
|
WHERE ta.disabled = 0
|
||||||
%s %s %s %s %s
|
%s %s %s
|
||||||
|
%s %s %s
|
||||||
GROUP BY id_group
|
GROUP BY id_group
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT COUNT(DISTINCT(ta.id_agente)) AS total, id_grupo AS g
|
SELECT COUNT(DISTINCT(ta.id_agente)) AS total, id_grupo AS g
|
||||||
FROM $table ta
|
FROM $table ta
|
||||||
%s
|
%s
|
||||||
WHERE ta.disabled = 0
|
WHERE ta.disabled = 0
|
||||||
%s %s %s %s %s
|
%s %s %s
|
||||||
|
%s %s %s
|
||||||
GROUP BY id_grupo
|
GROUP BY id_grupo
|
||||||
) x GROUP BY g";
|
) x GROUP BY g";
|
||||||
$sql_array = array();
|
$sql_array = array();
|
||||||
@ -2608,9 +2618,11 @@ class Tree {
|
|||||||
$sql_model,
|
$sql_model,
|
||||||
$s_array['header'],
|
$s_array['header'],
|
||||||
$filters['module_search_inner'],
|
$filters['module_search_inner'],
|
||||||
$s_array['condition'], $filters['agent_alias'], $filters['agent_status'], $filters['module_status'], $filters['module_search_condition'],
|
$s_array['condition'], $filters['agent_alias'], $filters['agent_status'],
|
||||||
|
$filters['module_status'], $filters['module_search_condition'], $secondary_group_acl,
|
||||||
$filters['module_search_inner'],
|
$filters['module_search_inner'],
|
||||||
$s_array['condition'], $filters['agent_alias'], $filters['agent_status'], $filters['module_status'], $filters['module_search_condition']
|
$s_array['condition'], $filters['agent_alias'], $filters['agent_status'],
|
||||||
|
$filters['module_status'], $filters['module_search_condition'], $group_acl
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$sql = "SELECT $fields FROM (" . implode(" UNION ALL ", $sql_array) . ") x2 GROUP BY g";
|
$sql = "SELECT $fields FROM (" . implode(" UNION ALL ", $sql_array) . ") x2 GROUP BY g";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user