Fixed blocked group in group_list

This commit is contained in:
danielmaya 2018-01-04 16:34:40 +01:00
parent 2ad1fe7d79
commit 43ec1cb7f4
2 changed files with 14 additions and 9 deletions

View File

@ -334,7 +334,13 @@ if (($delete_group) && (check_acl($config['id_user'], 0, "PM"))) {
} }
} }
db_clean_cache(); 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%'; $table->width = '100%';
@ -342,7 +348,7 @@ $all_parents = array();
$groups_count = 0; $groups_count = 0;
$sons = array(); $sons = array();
$groups_count = count($groups);
foreach ($groups as $k => $g) { foreach ($groups as $k => $g) {
if ($g['parent'] != 0) { if ($g['parent'] != 0) {
@ -360,8 +366,6 @@ foreach ($all_parents as $parent) {
} }
$groups_count = count($groups);
if (!empty($groups)) { if (!empty($groups)) {
$table->class = "databox data"; $table->class = "databox data";
$table->head = array (); $table->head = array ();

View File

@ -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. * @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') { function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup = true, $returnAllColumns = false,
static $group_cache = array(); $id_groups = null, $keys_field = 'id_grupo', $cache = true) {
static $group_cache = array();
if (empty ($id_user)) { if (empty ($id_user)) {
global $config; global $config;
@ -162,9 +163,9 @@ function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup
$id_user = $config['id_user']; $id_user = $config['id_user'];
} }
} }
// Check the group cache first. // 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]; $groups = $group_cache[$id_user];
} else { } else {
// Admin. // 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 // Add the All group to the beginning to be always the first
array_unshift($groups, $groupall); array_unshift($groups, $groupall);
} }
$acl_column = get_acl_column($privilege); $acl_column = get_acl_column($privilege);
foreach ($groups as $group) { foreach ($groups as $group) {