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>
* 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 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);

View File

@ -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();