From 43ec1cb7f4a391fa0ab40306768991b693f75a77 Mon Sep 17 00:00:00 2001 From: danielmaya Date: Thu, 4 Jan 2018 16:34:40 +0100 Subject: [PATCH] Fixed blocked group in group_list --- pandora_console/godmode/groups/group_list.php | 12 ++++++++---- pandora_console/include/functions_users.php | 11 ++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index 6be8d61b40..e62a8f4a86 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -334,7 +334,13 @@ if (($delete_group) && (check_acl($config['id_user'], 0, "PM"))) { } } db_clean_cache(); -$groups = users_get_groups_tree ($config['id_user'], "AR", true); + +if ($create_group || $delete_group || $update_group) { + $groups = users_get_groups ($config['id_user'], "AR", true, true, null, 'id_grupo', false); + $groups = groups_get_groups_tree_recursive($groups); +} else { + $groups = users_get_groups_tree ($config['id_user'], "AR", true); +} $table->width = '100%'; @@ -342,7 +348,7 @@ $all_parents = array(); $groups_count = 0; $sons = array(); - +$groups_count = count($groups); foreach ($groups as $k => $g) { if ($g['parent'] != 0) { @@ -360,8 +366,6 @@ foreach ($all_parents as $parent) { } -$groups_count = count($groups); - if (!empty($groups)) { $table->class = "databox data"; $table->head = array (); diff --git a/pandora_console/include/functions_users.php b/pandora_console/include/functions_users.php index 473a751e92..4a3ccd9169 100755 --- a/pandora_console/include/functions_users.php +++ b/pandora_console/include/functions_users.php @@ -151,8 +151,9 @@ function users_get_groups_for_select($id_user, $privilege = "AR", $returnAllGro * * @return array A list of the groups the user has certain privileges. */ -function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup = true, $returnAllColumns = false, $id_groups = null, $keys_field = 'id_grupo') { - static $group_cache = array(); +function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup = true, $returnAllColumns = false, + $id_groups = null, $keys_field = 'id_grupo', $cache = true) { + static $group_cache = array(); if (empty ($id_user)) { global $config; @@ -162,9 +163,9 @@ function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup $id_user = $config['id_user']; } } - + // Check the group cache first. - if (array_key_exists($id_user, $group_cache)) { + if (array_key_exists($id_user, $group_cache) && $cache) { $groups = $group_cache[$id_user]; } else { // Admin. @@ -238,7 +239,7 @@ function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup // Add the All group to the beginning to be always the first array_unshift($groups, $groupall); } - + $acl_column = get_acl_column($privilege); foreach ($groups as $group) {