2013-11-20 Miguel de Dios <miguel.dedios@artica.es>

* 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.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9105 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-11-20 13:14:12 +00:00
parent 2e3ff21e67
commit 35ae895c48
3 changed files with 61 additions and 15 deletions

View File

@ -1,3 +1,9 @@
2013-11-20 Miguel de Dios <miguel.dedios@artica.es>
* 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 <sergio.martin@artica.es> 2013-11-20 Sergio Martin <sergio.martin@artica.es>
* mobile/operation/events.php: Fix new events load condition * mobile/operation/events.php: Fix new events load condition

View File

@ -118,16 +118,32 @@ $table->data[1][1] .= '</span>';
$table->data[2][0] = __('Parent'); $table->data[2][0] = __('Parent');
$acl_parent = true;
if ($id_group) { 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 { else {
$table->data[2][1] = html_print_select_groups(false, "AR", true, 'id_parent', $id_parent, '', '', '', true); $table->data[2][1] = html_print_select_groups(false, "AR", true, 'id_parent', $id_parent, '', '', '', true);
} }
if ($acl_parent) {
$table->data[2][1] .= ' <span id="parent_preview">'; $table->data[2][1] .= ' <span id="parent_preview">';
$table->data[2][1] .= html_print_image("images/groups_small/".groups_get_icon ($id_parent).".png", true); $table->data[2][1] .= html_print_image("images/groups_small/".groups_get_icon ($id_parent).".png", true);
$table->data[2][1] .= '</span>'; $table->data[2][1] .= '</span>';
}
$table->data[3][0] = __('Alerts'); $table->data[3][0] = __('Alerts');
$table->data[3][1] = html_print_checkbox ('alerts_enabled', 1, ! $alerts_disabled, true); $table->data[3][1] = html_print_checkbox ('alerts_enabled', 1, ! $alerts_disabled, true);

View File

@ -122,7 +122,8 @@ if (defined('METACONSOLE')) {
} }
else { 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'; $sec = 'gagente';
} }
@ -261,6 +262,7 @@ 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); $groups = users_get_groups_tree ($config['id_user'], "AR", true);
$table->width = '98%'; $table->width = '98%';
$groups_count = 0; $groups_count = 0;
@ -270,10 +272,29 @@ foreach($groups as $k => $g) {
$groups_count++; $groups_count++;
} }
else if ($g['parent'] != 0) { else if ($g['parent'] != 0) {
//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; $sons[$g['parent']][] = $g;
unset($groups[$k]); unset($groups[$k]);
} }
else {
$groups_count++;
} }
}
}
if (check_acl($config['id_user'], 0, "PM")) { if (check_acl($config['id_user'], 0, "PM")) {
echo '<br />'; echo '<br />';
@ -300,6 +321,8 @@ if (!empty($groups)) {
$offset = (int)get_parameter('offset', 0); $offset = (int)get_parameter('offset', 0);
$limit = $offset + $config['block_size']; $limit = $offset + $config['block_size'];
$pagination = ui_pagination($groups_count, $pagination = ui_pagination($groups_count,
false, 0, $config['block_size'], true, 'offset', false); false, 0, $config['block_size'], true, 'offset', false);
@ -325,7 +348,8 @@ if (!empty($groups)) {
} }
$iterator++; $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; echo $pagination;