diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 197c3243ad..9e9569f150 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2011-02-17 Juan Manuel Ramon + + * include/functions_reports.php + godmode/reporting/reporting_builder.main.php + godmode/reporting/reporting_builder.php:Only administrator users can select and see + group All in this views. + + Fix: #3183412, 3183413 + 2011-02-07 Javier Lanz * godmode/gis_maps/index.php: Only display Default column to an admin user diff --git a/pandora_console/godmode/reporting/reporting_builder.main.php b/pandora_console/godmode/reporting/reporting_builder.main.php index 6b07f2b301..e4f583c7fb 100644 --- a/pandora_console/godmode/reporting/reporting_builder.main.php +++ b/pandora_console/godmode/reporting/reporting_builder.main.php @@ -52,7 +52,12 @@ $table->data['name'][0] = __('Name'); $table->data['name'][1] = print_input_text('name', $reportName, __('Name'), 20, 40, true); $table->data['group'][0] = __('Group'); -$table->data['group'][1] = print_select_groups(false, "AR", true, 'id_group', $idGroupReport, false, '', '', true); +$own_info = get_user_info ($config['id_user']); +if ($own_info['is_admin'] || give_acl ($config['id_user'], 0, "PM")) + $return_all_groups = true; +else + $return_all_groups = false; +$table->data['group'][1] = print_select_groups(false, "AR", $return_all_groups, 'id_group', $idGroupReport, false, '', '', true); $table->data['description'][0] = __('Description'); $table->data['description'][1] = print_textarea('description', 5, 15, $description, '', true); diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index fa8bee9714..669c1f163f 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -50,8 +50,14 @@ switch ($action) { __('Could not be deleted')); } + $own_info = get_user_info ($config['id_user']); + if ($own_info['is_admin'] || give_acl ($config['id_user'], 0, "PM")) + $return_all_group = true; + else + $return_all_group = false; + $reports = get_reports (array ('order' => 'name'), - array ('name', 'id_report', 'description', 'private', 'id_user', 'id_group')); + array ('name', 'id_report', 'description', 'private', 'id_user', 'id_group'), $return_all_group, 'IW'); $table->width = '0px'; if (sizeof ($reports)) { $table->id = 'report_list'; diff --git a/pandora_console/include/functions_reports.php b/pandora_console/include/functions_reports.php index 5e3c1f0e67..c1cef8106b 100644 --- a/pandora_console/include/functions_reports.php +++ b/pandora_console/include/functions_reports.php @@ -62,7 +62,7 @@ function get_report ($id_report, $filter = false, $fields = false) { * * @return array An array with all the reports the user can view. */ -function get_reports ($filter = false, $fields = false) { +function get_reports ($filter = false, $fields = false, $returnAllGroup = true, $privileges = 'IR') { global $config; if (! is_array ($filter)) @@ -74,10 +74,14 @@ function get_reports ($filter = false, $fields = false) { $fields[] = 'id_user'; } + $groups = get_user_groups ($config['id_user'], $privileges, $returnAllGroup); + $reports = array (); $all_reports = @get_db_all_rows_filter ('treport', $filter, $fields); if ($all_reports !== FALSE) foreach ($all_reports as $report){ + if (!in_array($report['id_group'], array_keys($groups))) + continue; if ($config['id_user'] != $report['id_user'] && ! give_acl ($config['id_user'], $report['id_group'], 'AR')) continue; array_push ($reports, $report);