2013-11-19 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* include/functions_groups.php
	  include/functions_users.php: Fix combo groups.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9096 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
vgilc 2013-11-19 12:42:35 +00:00
parent 20b6a46055
commit 5ae968a728
3 changed files with 27 additions and 11 deletions

View File

@ -1,3 +1,8 @@
2013-11-19 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_groups.php
include/functions_users.php: Fix combo groups.
2013-11-19 Juan Manuel Ramon <juanmanuel.ramon@artica.es> 2013-11-19 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* godmode/reporting/reporting_builder.php: Fix filter groups * godmode/reporting/reporting_builder.php: Fix filter groups

View File

@ -483,10 +483,11 @@ function groups_flatten_tree_groups($tree, $deep) {
* @param array $groups The list of groups to create the treefield list. * @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 $parent The id_group of parent actual scan branch.
* @param integer $deep The level of profundity in the 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. * @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(); $return = array();
$tree = $groups; $tree = $groups;
@ -495,6 +496,12 @@ function groups_get_groups_tree_recursive($groups, $trash = 0, $trash2 = 0) {
continue; 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, // If the user has ACLs on a gruop but not in his father,
// we consider it as a son of group "all" // we consider it as a son of group "all"
if(!in_array($group['parent'], array_keys($groups))) { if(!in_array($group['parent'], array_keys($groups))) {
@ -506,12 +513,15 @@ function groups_get_groups_tree_recursive($groups, $trash = 0, $trash2 = 0) {
} }
// Depends on the All group we give different format # Fix : Don't execute this code if for_select = true
if (isset($groups[0])) { if (!$for_select){
$tree = array($tree[0]); // Depends on the All group we give different format
} if (isset($groups[0])) {
else { $tree = array($tree[0]);
$tree = $tree[0]['branch']; }
else {
$tree = $tree[0]['branch'];
}
} }
$return = groups_flatten_tree_groups($tree, 0); $return = groups_flatten_tree_groups($tree, 0);

View File

@ -112,7 +112,8 @@ function users_get_groups_for_select($id_user, $privilege = "AR", $returnAllGro
$first_group = reset(array_slice($user_groups, 0, 1)); $first_group = reset(array_slice($user_groups, 0, 1));
$parent_group = $first_group['parent']; $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(); $fields = array();