Fixed problem in tree view with parent nodes and permissions. Ticket#3388

This commit is contained in:
Arturo Gonzalez 2016-02-16 16:21:21 +01:00
parent e808ba7e76
commit daae8b9088
1 changed files with 8 additions and 0 deletions

View File

@ -1130,6 +1130,14 @@ class Tree {
foreach ($items as $item) {
$groups[$item['id']] = $this->getProcessedItem($item);
}
// If user have not permissions in parent, set parent node to 0 (all)
$user_groups_with_privileges = users_get_groups($config['id_user']);
foreach ($groups as $id => $group) {
if (!in_array($groups[$id]['parent'], array_keys($user_groups_with_privileges))) {
$groups[$id]['parent'] = 0;
}
}
// Build the group hierarchy
foreach ($groups as $id => $group) {
if (isset($groups[$id]['parent']) && ($groups[$id]['parent'] != 0)) {