From bf88f47af1257c1bc1121bdf18b85dc5edcf5054 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Tue, 19 Nov 2013 16:21:42 +0000 Subject: [PATCH] 2013-11-19 Ramon Novoa * godmode/reporting/reporting_builder.php, include/functions_groups.php, include/functions_users.php: Reverted changes for TSOL. Will be merged after the 5.0SP1 release. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9100 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 7 ++++ .../godmode/reporting/reporting_builder.php | 39 ++----------------- pandora_console/include/functions_groups.php | 28 +++++-------- pandora_console/include/functions_users.php | 5 +-- 4 files changed, 21 insertions(+), 58 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index e42e18d28e..d5b4825144 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2013-11-19 Ramon Novoa + + * godmode/reporting/reporting_builder.php, + include/functions_groups.php, + include/functions_users.php: Reverted changes for TSOL. Will be merged + after the 5.0SP1 release. + 2013-11-19 Miguel de Dios * include/config_process.php: added lost line about the autorefresh. diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index f30d722864..9ed08a4006 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -55,12 +55,7 @@ if ($idReport != 0) { $edit = false; switch ($type_access_selected) { case 'group_view': - ## Workaround for user without RW,RM flags that want to delete reports - $delete_report_wa = get_parameter('action', 'none'); - if ($delete_report_wa === 'delete_report') - $edit = check_acl($config['id_user'], $report['id_group'], "RR"); - else - $edit = check_acl($config['id_user'], $report['id_group'], "RW"); + $edit = check_acl($config['id_user'], $report['id_group'], "RW"); break; case 'group_edit': $edit = check_acl($config['id_user'], $report['id_group_edit'], "RW"); @@ -341,17 +336,6 @@ switch ($action) { 'order' => 'name' ); } - - # Fix : group filter was not working - // Show only selected groups - if ($id_group > 0) { - $group = array("$id_group" => $id_group); - $filter['id_group'] = $id_group; - } - else { - $group = false; - } - // Filter normal and metaconsole reports if ($config['metaconsole'] == 1 and defined('METACONSOLE')) @@ -362,7 +346,6 @@ switch ($action) { $reports = reports_get_reports ($filter, array ('name', 'id_report', 'description', 'private', 'id_user', 'id_group'), $return_all_group, 'RR', $group); - $table->width = '0px'; if (sizeof ($reports)) { $table->id = 'report_list'; @@ -399,15 +382,6 @@ switch ($action) { $table->size[$next] = '80px'; $table->style[$next] = 'text-align:center;'; - } - ## Workaround for users without RM flag that want to delete reports - elseif (check_acl ($config['id_user'], 0, "RR")) { - - $table->head[$next] = '' . __('Op.') . ''; - $table->size = array (); - $table->size[$next] = '80px'; - $table->style[$next] = 'text-align:center;'; - } foreach ($reports as $report) { @@ -489,18 +463,13 @@ switch ($action) { $data[$next] .= html_print_input_hidden ('id_report', $report['id_report'], true); $data[$next] .= html_print_input_image ('edit', 'images/config.png', 1, '', true, array ('title' => __('Edit'))); $data[$next] .= ''; - } - - ## Workaround for users without RM flag that want to delete reports - if (check_acl ($config['id_user'], 0, "RR")) { - + $data[$next] .= '
'; $data[$next] .= html_print_input_hidden ('id_report', $report['id_report'], true); $data[$next] .= html_print_input_hidden ('action','delete_report', true); $data[$next] .= html_print_input_image ('delete', 'images/cross.png', 1, '', true, array ('title' => __('Delete'))); $data[$next] .= '
'; - } array_push ($table->data, $data); @@ -571,7 +540,6 @@ switch ($action) { $private = 1; break; } - if ($action == 'update') { if ($reportName != "" && $idGroupReport != "") { $new_values = array('name' => $reportName, @@ -615,14 +583,13 @@ switch ($action) { $metaconsole_report = 0; $start_url = ui_get_full_url(false, false, false, false); - $first_page = "<p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;"><img src="" . $start_url . "/images/logo_telefonica.jpg" alt="" width="800" /></p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;"><span style="font-size: xx-large;">(_REPORT_NAME_)</span></p> <p style="text-align: center;"><span style="font-size: large;">(_DATETIME_)</span></p>"; + $first_page = "<p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;"><img src="" . $start_url . "/images/pandora_report_logo.png" alt="" width="800" /></p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;"><span style="font-size: xx-large;">(_REPORT_NAME_)</span></p> <p style="text-align: center;"><span style="font-size: large;">(_DATETIME_)</span></p>"; $idOrResult = db_process_sql_insert('treport', array('name' => $reportName, 'id_group' => $idGroupReport, 'description' => $description, 'first_page' => $first_page, - 'custom_logo' => 'images/custom_logo/logo_telefonica_cabecera.jpg', 'private' => $private, 'id_group_edit' => $id_group_edit, 'id_user' => $config['id_user'], diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index 2b1771106e..9a935fcb0e 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -483,11 +483,10 @@ 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, $for_select = false) { +function groups_get_groups_tree_recursive($groups, $trash = 0, $trash2 = 0) { $return = array(); $tree = $groups; @@ -495,12 +494,6 @@ function groups_get_groups_tree_recursive($groups, $trash = 0, $trash2 = 0, $for 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" @@ -512,17 +505,14 @@ function groups_get_groups_tree_recursive($groups, $trash = 0, $trash2 = 0, $for $tree[$group['parent']]['branch'][$key] = &$tree[$key]; } - - # 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']; - } - } + + // 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); diff --git a/pandora_console/include/functions_users.php b/pandora_console/include/functions_users.php index 88628bd641..a4ae6cc06f 100644 --- a/pandora_console/include/functions_users.php +++ b/pandora_console/include/functions_users.php @@ -111,9 +111,8 @@ 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']; - - # 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); + + $user_groups_tree = groups_get_groups_tree_recursive($user_groups, $parent_group); } $fields = array();