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:
parent
2e3ff21e67
commit
35ae895c48
|
@ -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>
|
||||
|
||||
* mobile/operation/events.php: Fix new events load condition
|
||||
|
|
|
@ -118,16 +118,32 @@ $table->data[1][1] .= '</span>';
|
|||
|
||||
$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] .= ' <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] .= '</span>';
|
||||
|
||||
if ($acl_parent) {
|
||||
$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] .= '</span>';
|
||||
}
|
||||
|
||||
$table->data[3][0] = __('Alerts');
|
||||
$table->data[3][1] = html_print_checkbox ('alerts_enabled', 1, ! $alerts_disabled, true);
|
||||
|
|
|
@ -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 '<br />';
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/groups/configure_group&pure='.$pure.'">';
|
||||
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue