diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 8b3905a1b6..32244a6b26 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2013-11-19 Juan Manuel Ramon + + * include/functions_groups.php + include/functions_users.php: Fix combo groups. + 2013-11-19 Juan Manuel Ramon * godmode/reporting/reporting_builder.php: Fix filter groups diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index 9a935fcb0e..2b1771106e 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -483,10 +483,11 @@ function groups_flatten_tree_groups($tree, $deep) { * @param array $groups The list of groups to create the treefield list. * @param integer $parent The id_group of parent actual scan branch. * @param integer $deep The level of profundity in the branch. + * @param boolean $for_select This flag will be true if this function is used for select group filter # Fix! * * @return array The treefield list of groups. */ -function groups_get_groups_tree_recursive($groups, $trash = 0, $trash2 = 0) { +function groups_get_groups_tree_recursive($groups, $trash = 0, $trash2 = 0, $for_select = false) { $return = array(); $tree = $groups; @@ -494,6 +495,12 @@ function groups_get_groups_tree_recursive($groups, $trash = 0, $trash2 = 0) { if ($group['id_grupo'] == 0) { continue; } + + # Fix : Don't execute this code if for_select = true + if (!$for_select){ + + $tree[$group['parent']]['hash_branch'] = 1; + $tree[$group['parent']]['branch'][$key] = &$tree[$key]; // If the user has ACLs on a gruop but not in his father, // we consider it as a son of group "all" @@ -505,14 +512,17 @@ function groups_get_groups_tree_recursive($groups, $trash = 0, $trash2 = 0) { $tree[$group['parent']]['branch'][$key] = &$tree[$key]; } - - // Depends on the All group we give different format - if (isset($groups[0])) { - $tree = array($tree[0]); - } - else { - $tree = $tree[0]['branch']; - } + + # Fix : Don't execute this code if for_select = true + if (!$for_select){ + // Depends on the All group we give different format + if (isset($groups[0])) { + $tree = array($tree[0]); + } + else { + $tree = $tree[0]['branch']; + } + } $return = groups_flatten_tree_groups($tree, 0); diff --git a/pandora_console/include/functions_users.php b/pandora_console/include/functions_users.php index a4ae6cc06f..88628bd641 100644 --- a/pandora_console/include/functions_users.php +++ b/pandora_console/include/functions_users.php @@ -111,8 +111,9 @@ function users_get_groups_for_select($id_user, $privilege = "AR", $returnAllGro // First group it's needed to retrieve its parent group $first_group = reset(array_slice($user_groups, 0, 1)); $parent_group = $first_group['parent']; - - $user_groups_tree = groups_get_groups_tree_recursive($user_groups, $parent_group); + + # Fix : Added new parameter to avoid bad behaviour in this function + $user_groups_tree = groups_get_groups_tree_recursive($user_groups, $parent_group, 0, true); } $fields = array();