diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 3a3522a045..d1e230cc86 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2013-11-20 Miguel de Dios + + * godmode/groups/configure_group.php, godmode/groups/group_list.php: + fixed the show and edit groups with the ACL of the user has not + access to the parent. + 2013-11-20 Sergio Martin * mobile/operation/events.php: Fix new events load condition diff --git a/pandora_console/godmode/groups/configure_group.php b/pandora_console/godmode/groups/configure_group.php index 3616f1b3bb..c3693f0a00 100644 --- a/pandora_console/godmode/groups/configure_group.php +++ b/pandora_console/godmode/groups/configure_group.php @@ -118,16 +118,32 @@ $table->data[1][1] .= ''; $table->data[2][0] = __('Parent'); +$acl_parent = true; if ($id_group) { - $table->data[2][1] = html_print_select_groups(false, "AR", true, 'id_parent', $id_parent, - '', '', '', true, false, true, '', false, false, false, $id_group); + + //The user can access to the parent, but she want to edit the group. + if (!check_acl($config['id_user'], $id_parent, "AR")) { + $acl_parent = false; + + $table->data[2][1] = + __('You have not access to the parent.') . + html_print_input_hidden('id_parent', $id_parent, true); + } + else { + $table->data[2][1] = html_print_select_groups(false, "AR", true, + 'id_parent', $id_parent, '', '', '', true, false, true, '', + false, false, false, $id_group); + } } else { $table->data[2][1] = html_print_select_groups(false, "AR", true, 'id_parent', $id_parent, '', '', '', true); } -$table->data[2][1] .= ' '; -$table->data[2][1] .= html_print_image("images/groups_small/".groups_get_icon ($id_parent).".png", true); -$table->data[2][1] .= ''; + +if ($acl_parent) { + $table->data[2][1] .= ' '; + $table->data[2][1] .= html_print_image("images/groups_small/".groups_get_icon ($id_parent).".png", true); + $table->data[2][1] .= ''; +} $table->data[3][0] = __('Alerts'); $table->data[3][1] = html_print_checkbox ('alerts_enabled', 1, ! $alerts_disabled, true); diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index 9e7d7b3b97..9d1c997f2d 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -122,7 +122,8 @@ if (defined('METACONSOLE')) { } else { - ui_print_page_header (__("Groups defined in Pandora"), "images/group.png", false, "", true, ""); + ui_print_page_header (__("Groups defined in Pandora"), + "images/group.png", false, "", true, ""); $sec = 'gagente'; } @@ -261,20 +262,40 @@ if (($delete_group) && (check_acl($config['id_user'], 0, "PM"))) { } db_clean_cache(); $groups = users_get_groups_tree ($config['id_user'], "AR", true); + $table->width = '98%'; $groups_count = 0; $sons = array(); -foreach($groups as $k => $g) { +foreach ($groups as $k => $g) { if ($g['parent'] == 0) { $groups_count++; } else if ($g['parent'] != 0) { - $sons[$g['parent']][] = $g; - unset($groups[$k]); + + //Check the group has the parent in the list + //else the group chage to hook in the all group + $found = false; + foreach ($groups as $check_g) { + if ($check_g['id_grupo'] == $g['parent']) { + $found = true; + break; + } + } + + + if ($found) { + $sons[$g['parent']][] = $g; + unset($groups[$k]); + } + else { + $groups_count++; + } } } + + if (check_acl($config['id_user'], 0, "PM")) { echo '
'; echo '
'; @@ -299,18 +320,20 @@ if (!empty($groups)) { $offset = (int)get_parameter('offset', 0); $limit = $offset + $config['block_size']; - + + + $pagination = ui_pagination($groups_count, false, 0, $config['block_size'], true, 'offset', false); - + $n = -1; $iterator = 0; $branch_classes = array(); foreach ($groups as $group) { $n++; - + // Only print the page range - if($n < $offset || $n >= $limit) { + if ($n < $offset || $n >= $limit) { continue; } @@ -325,9 +348,10 @@ if (!empty($groups)) { } $iterator++; - groups_print_group_sons($group, $sons, $branch_classes, $groups_count, $table, $iterator, $symbolBranchs); + groups_print_group_sons($group, $sons, $branch_classes, + $groups_count, $table, $iterator, $symbolBranchs); } - + echo $pagination; html_print_table ($table);