2011-02-17 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* 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 



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3911 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2011-02-17 18:44:48 +00:00
parent b73bd20296
commit 1ef03ea5b1
4 changed files with 27 additions and 3 deletions

View File

@ -1,3 +1,12 @@
2011-02-17 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* 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 <javier.lanz@artica.es> 2011-02-07 Javier Lanz <javier.lanz@artica.es>
* godmode/gis_maps/index.php: Only display Default column to an admin * godmode/gis_maps/index.php: Only display Default column to an admin
user user

View File

@ -52,7 +52,12 @@ $table->data['name'][0] = __('Name');
$table->data['name'][1] = print_input_text('name', $reportName, __('Name'), 20, 40, true); $table->data['name'][1] = print_input_text('name', $reportName, __('Name'), 20, 40, true);
$table->data['group'][0] = __('Group'); $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'][0] = __('Description');
$table->data['description'][1] = print_textarea('description', 5, 15, $description, '', true); $table->data['description'][1] = print_textarea('description', 5, 15, $description, '', true);

View File

@ -50,8 +50,14 @@ switch ($action) {
__('Could not be deleted')); __('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'), $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'; $table->width = '0px';
if (sizeof ($reports)) { if (sizeof ($reports)) {
$table->id = 'report_list'; $table->id = 'report_list';

View File

@ -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. * @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; global $config;
if (! is_array ($filter)) if (! is_array ($filter))
@ -74,10 +74,14 @@ function get_reports ($filter = false, $fields = false) {
$fields[] = 'id_user'; $fields[] = 'id_user';
} }
$groups = get_user_groups ($config['id_user'], $privileges, $returnAllGroup);
$reports = array (); $reports = array ();
$all_reports = @get_db_all_rows_filter ('treport', $filter, $fields); $all_reports = @get_db_all_rows_filter ('treport', $filter, $fields);
if ($all_reports !== FALSE) if ($all_reports !== FALSE)
foreach ($all_reports as $report){ 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')) if ($config['id_user'] != $report['id_user'] && ! give_acl ($config['id_user'], $report['id_group'], 'AR'))
continue; continue;
array_push ($reports, $report); array_push ($reports, $report);