From fabe14b7ea930ddf61dc674d62def6cd0356b51b Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 12 Feb 2018 12:38:28 +0100 Subject: [PATCH] fixed error acl --- pandora_console/include/functions_users.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/pandora_console/include/functions_users.php b/pandora_console/include/functions_users.php index 35be8ae5ac..2bea03cd42 100755 --- a/pandora_console/include/functions_users.php +++ b/pandora_console/include/functions_users.php @@ -140,6 +140,9 @@ function users_get_groups_for_select($id_user, $privilege = "AR", $returnAllGro } function get_group_ancestors($group_id, $groups) { + if($group_id == 0) { + return 0; + } if (!isset($groups[$group_id])) { return null; @@ -151,17 +154,13 @@ function get_group_ancestors($group_id, $groups) { return $group_id; } - if ($parent == 0) { - return 0; - } - $r = get_group_ancestors($parent, $groups); if (is_array($r)) { - $r = array_merge(array($parent), $r); + $r = array_merge(array($group_id), $r); } else { - $r = array($parent, $r); + $r = array($group_id, $r); } return $r; @@ -300,8 +299,7 @@ function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup } foreach ($groups as $group) { - $parents = get_group_ancestors($group["id_grupo"],$groups); - + $parents = get_group_ancestors($group["parent"],$groups); if (is_array($parents)) { foreach ($parents as $parent) { if ( (isset($forest_acl[$parent])) && ($groups[$parent]["propagate"] == 1)) { @@ -325,7 +323,6 @@ function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup } } } - // Update the group cache. $group_cache[$id_user] = $forest_acl; }