Merge branch '1867-Errores_en_vista_de_eventos_con_usuario_con_tags_2' into 'develop'

fixed error acl

See merge request artica/pandorafms!1290
This commit is contained in:
vgilc 2018-02-12 12:44:31 +01:00
commit b43bfa1cf8
1 changed files with 6 additions and 9 deletions

View File

@ -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;
}