[open-ils-commits] [GIT] Evergreen ILS branch master updated. dcf2493f4ead094c8ded527b120e8ae057a7e5f2

Evergreen Git git at git.evergreen-ils.org
Mon Dec 19 11:20:55 EST 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  dcf2493f4ead094c8ded527b120e8ae057a7e5f2 (commit)
       via  84cc8a18b0b516800915245dbdba87886f04202b (commit)
      from  512400e63a3cb5362545b7ca0cc9729ac628774a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit dcf2493f4ead094c8ded527b120e8ae057a7e5f2
Author: Dan Scott <dscott at laurentian.ca>
Date:   Mon Dec 19 11:17:12 2011 -0500

    Wrap upgrade script for CREATE_REPORT_TEMPLATE permission
    
    Permissions to create report templates will automatically be added to
    any group that currently has the ability to run reports as part of the
    upgrade process; if you want to make use of the ability to prevent some
    groups from creating ad-hoc reports, remove the CREATE_REPORT_TEMPLATE
    permission from permission.grp_perm_map for that group.
    
    Signed-off-by: Dan Scott <dscott at laurentian.ca>

diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 1573edb..defe858 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -86,7 +86,7 @@ CREATE TRIGGER no_overlapping_deps
     BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
     FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
 
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0658', :eg_version); -- jamesrf/dbs
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0659', :eg_version); -- tsbere/dbs
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/0659.add_create_report_perms.sql b/Open-ILS/src/sql/Pg/upgrade/0659.add_create_report_perms.sql
new file mode 100644
index 0000000..0133ff8
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/0659.add_create_report_perms.sql
@@ -0,0 +1,25 @@
+-- Evergreen DB patch 0659.add_create_report_perms.sql
+--
+-- Add a permission to control the ability to create report templates
+--
+BEGIN;
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('0659', :eg_version);
+
+-- FIXME: add/check SQL statements to perform the upgrade
+INSERT INTO permission.perm_list ( id, code, description ) VALUES
+ ( 516, 'CREATE_REPORT_TEMPLATE', oils_i18n_gettext( 516,
+    'Allows a user to create report templates', 'ppl', 'description' ));
+
+INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable)
+    SELECT grp, 516, depth, grantable
+        FROM permission.grp_perm_map
+        WHERE perm = (
+            SELECT id
+                FROM permission.perm_list
+                WHERE code = 'RUN_REPORTS'
+        );
+
+
+COMMIT;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.report_perms.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.report_perms.sql
deleted file mode 100644
index 1eb1ff3..0000000
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.report_perms.sql
+++ /dev/null
@@ -1,12 +0,0 @@
-INSERT INTO permission.perm_list ( id, code, description ) VALUES
- ( 516, 'CREATE_REPORT_TEMPLATE', oils_i18n_gettext( 516,
-    'Allows a user to create report templates', 'ppl', 'description' ));
-
-INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable)
-    SELECT grp, 516, depth, grantable
-        FROM permission.grp_perm_map
-        WHERE perm = (
-            SELECT id
-                FROM permission.perm_list
-                WHERE code = 'RUN_REPORTS'
-        );

commit 84cc8a18b0b516800915245dbdba87886f04202b
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Sun Sep 25 15:00:08 2011 -0400

    Add permission for creating report templates
    
    Because we would like people to be able to run them, but not create them.
    
    Also, allow VIEW_REPORT_OUTPUT in reporter interface, so
    that you can see the contents of shared output folders.
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Dan Scott <dscott at laurentian.ca>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Reporter.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Reporter.pm
index 6e9468a..44590f0 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Reporter.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Reporter.pm
@@ -20,6 +20,7 @@ sub create_folder {
 	my $e = new_rstore_editor(xact=>1, authtoken=>$auth);
 	return $e->die_event unless $e->checkauth;
 	return $e->die_event unless $e->allowed('RUN_REPORTS');
+	return $e->die_event unless ($type ne 'template' || $e->allowed('CREATE_REPORT_TEMPLATE'));
 
 	return 0 if $folder->owner ne $e->requestor->id;
 
@@ -63,7 +64,11 @@ sub retrieve_visible_folders {
 	my( $self, $conn, $auth, $type ) = @_;
 	my $e = new_rstore_editor(authtoken=>$auth);
 	return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed('RUN_REPORTS');
+	if($type eq 'output') {
+		return $e->event unless $e->allowed(['RUN_REPORTS','VIEW_REPORT_OUTPUT']);
+	} else {
+		return $e->event unless $e->allowed('RUN_REPORTS');
+	}
 
 	my $class = 'rrf';
 	$class = 'rtf' if $type eq 'template';
@@ -107,7 +112,11 @@ sub retrieve_folder_data {
 	my( $self, $conn, $auth, $type, $folderid, $limit ) = @_;
 	my $e = new_rstore_editor(authtoken=>$auth);
 	return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed('RUN_REPORTS');
+	if($type eq 'output') {
+		return $e->event unless $e->allowed(['RUN_REPORTS','VIEW_REPORT_OUTPUT']);
+	} else {
+		return $e->event unless $e->allowed('RUN_REPORTS');
+	}
 	my $meth = "search_reporter_${type}";
 	my $class = 'rr';
 	$class = 'rt' if $type eq 'template';
@@ -127,7 +136,7 @@ sub retrieve_schedules {
 	my( $self, $conn, $auth, $folderId, $limit, $complete ) = @_;
 	my $e = new_rstore_editor(authtoken=>$auth);
 	return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed('RUN_REPORTS');
+	return $e->event unless $e->allowed(['RUN_REPORTS','VIEW_REPORT_OUTPUT']);
 
 	my $search = { folder => $folderId };
 	my $query = [
@@ -153,7 +162,7 @@ sub retrieve_schedule {
 	my( $self, $conn, $auth, $sched_id ) = @_;
 	my $e = new_rstore_editor(authtoken=>$auth);
 	return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed('RUN_REPORTS');
+	return $e->event unless $e->allowed(['RUN_REPORTS','VIEW_REPORT_OUTPUT']);
 	my $s = $e->retrieve_reporter_schedule($sched_id)
 		or return $e->event;
 	return $s;
@@ -168,6 +177,7 @@ sub create_template {
 	my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
 	return $e->die_event unless $e->checkauth;
 	return $e->die_event unless $e->allowed('RUN_REPORTS');
+	return $e->die_event unless $e->allowed('CREATE_REPORT_TEMPLATE');
 	$template->owner($e->requestor->id);
 
 	my $existing = $e->search_reporter_template( {owner=>$template->owner,
@@ -229,7 +239,7 @@ sub retrieve_template {
 	my( $self, $conn, $auth, $id ) = @_;
 	my $e = new_rstore_editor(authtoken=>$auth);
 	return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed('RUN_REPORTS');
+	return $e->event unless $e->allowed(['RUN_REPORTS','VIEW_REPORT_OUTPUT']);
 	my $t = $e->retrieve_reporter_template($id)
 		or return $e->event;
 	return $t;
@@ -243,7 +253,7 @@ sub retrieve_report {
 	my( $self, $conn, $auth, $id ) = @_;
 	my $e = new_rstore_editor(authtoken=>$auth);
 	return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed('RUN_REPORTS');
+	return $e->event unless $e->allowed(['RUN_REPORTS','VIEW_REPORT_OUTPUT']);
 	my $r = $e->retrieve_reporter_report($id)
 		or return $e->event;
 	return $r;
@@ -258,6 +268,7 @@ sub update_template {
 	my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
 	return $e->die_event unless $e->checkauth;
 	return $e->die_event unless $e->allowed('RUN_REPORTS');
+	return $e->die_event unless $e->allowed('CREATE_REPORT_TEMPLATE');
 	my $t = $e->retrieve_reporter_template($tmpl->id)
 		or return $e->die_event;
 	return 0 if $t->owner ne $e->requestor->id;
diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
index 41e8d19..eca99a4 100644
--- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql
+++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
@@ -1446,7 +1446,9 @@ INSERT INTO permission.perm_list ( id, code, description ) VALUES
  ( 514, 'UPDATE_PATRON_ACTIVE_CARD', oils_i18n_gettext( 514,
     'Allows a user to manually adjust a patron''s active cards', 'ppl', 'description')),
  ( 515, 'UPDATE_PATRON_PRIMARY_CARD', oils_i18n_gettext( 515,
-    'Allows a user to manually adjust a patron''s primary card', 'ppl', 'description'));
+    'Allows a user to manually adjust a patron''s primary card', 'ppl', 'description')),
+ ( 516, 'CREATE_REPORT_TEMPLATE', oils_i18n_gettext( 516,
+    'Allows a user to create report templates', 'ppl', 'description' ));
 
 SELECT SETVAL('permission.perm_list_id_seq'::TEXT, 1000);
 
@@ -1795,6 +1797,7 @@ INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable)
 			'CREATE_COPY_STAT_CAT_ENTRY',
 			'CREATE_COPY_STAT_CAT_ENTRY_MAP',
 			'RUN_REPORTS',
+			'CREATE_REPORT_TEMPLATE',
 			'SHARE_REPORT_FOLDER',
 			'UPDATE_COPY_LOCATION',
 			'UPDATE_COPY_STAT_CAT',
@@ -2195,6 +2198,7 @@ INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable)
 			'DELETE_INVOICE_METHOD',
 			'DELETE_PROVIDER',
 			'RUN_REPORTS',
+			'CREATE_REPORT_TEMPLATE',
 			'SHARE_REPORT_FOLDER',
 			'UPDATE_ACQ_FUNDING_SOURCE',
 			'UPDATE_INVOICE_ITEM_TYPE',
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.report_perms.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.report_perms.sql
new file mode 100644
index 0000000..1eb1ff3
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.report_perms.sql
@@ -0,0 +1,12 @@
+INSERT INTO permission.perm_list ( id, code, description ) VALUES
+ ( 516, 'CREATE_REPORT_TEMPLATE', oils_i18n_gettext( 516,
+    'Allows a user to create report templates', 'ppl', 'description' ));
+
+INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable)
+    SELECT grp, 516, depth, grantable
+        FROM permission.grp_perm_map
+        WHERE perm = (
+            SELECT id
+                FROM permission.perm_list
+                WHERE code = 'RUN_REPORTS'
+        );
diff --git a/Open-ILS/web/reports/oils_rpt.js b/Open-ILS/web/reports/oils_rpt.js
index 835e06e..ef6e7e2 100644
--- a/Open-ILS/web/reports/oils_rpt.js
+++ b/Open-ILS/web/reports/oils_rpt.js
@@ -1,4 +1,4 @@
-var perms = [ 'RUN_REPORTS', 'SHARE_REPORT_FOLDER' ];
+var perms = [ 'RUN_REPORTS', 'SHARE_REPORT_FOLDER', 'VIEW_REPORT_OUTPUT' ];
 
 function oilsInitReports() {
 	oilsRptIdObjects();
@@ -16,7 +16,7 @@ function oilsInitReports() {
 	if( cgi.param('dbg') ) oilsRptDebugEnabled = true;
 
 	fetchHighestPermOrgs(SESSION, USER.id(), perms);
-	if( PERMS.RUN_REPORTS == -1 ) {
+	if( PERMS.RUN_REPORTS == -1 && PERMS.VIEW_REPORT_OUTPUT == -1 ) {
 		unHideMe(DOM.oils_rpt_permission_denied);
 		hideMe(DOM.oils_rpt_tree_loading);
 		return false;
diff --git a/Open-ILS/web/reports/oils_rpt_folders.js b/Open-ILS/web/reports/oils_rpt_folders.js
index 4b9346b..40c6465 100644
--- a/Open-ILS/web/reports/oils_rpt_folders.js
+++ b/Open-ILS/web/reports/oils_rpt_folders.js
@@ -169,13 +169,15 @@ oilsRptFolderManager.prototype.createTopFolder = function(type, orgsel) {
 
 oilsRptFolderManager.prototype.fetchFolders = function(auth) {
 	var obj = this;
-	var req = new Request(OILS_RPT_FETCH_FOLDERS, auth, 'template');
-	req.callback( function(r) { obj.drawFolders('template', r.getResultObject()); } );
-	req.send();
-
-	var req = new Request(OILS_RPT_FETCH_FOLDERS, auth, 'report');
-	req.callback( function(r) { obj.drawFolders('report', r.getResultObject()); } );
-	req.send();
+	if(PERMS.RUN_REPORTS != -1) {
+		var req = new Request(OILS_RPT_FETCH_FOLDERS, auth, 'template');
+		req.callback( function(r) { obj.drawFolders('template', r.getResultObject()); } );
+		req.send();
+
+		var req = new Request(OILS_RPT_FETCH_FOLDERS, auth, 'report');
+		req.callback( function(r) { obj.drawFolders('report', r.getResultObject()); } );
+		req.send();
+	}
 
 	var req = new Request(OILS_RPT_FETCH_FOLDERS, auth, 'output');
 	req.callback( function(r) { obj.drawFolders('output', r.getResultObject()); } );

-----------------------------------------------------------------------

Summary of changes:
 .../perlmods/lib/OpenILS/Application/Reporter.pm   |   23 +++++++++++++----
 Open-ILS/src/sql/Pg/002.schema.config.sql          |    2 +-
 Open-ILS/src/sql/Pg/950.data.seed-values.sql       |    6 ++++-
 .../Pg/upgrade/0659.add_create_report_perms.sql    |   25 ++++++++++++++++++++
 Open-ILS/web/reports/oils_rpt.js                   |    4 +-
 Open-ILS/web/reports/oils_rpt_folders.js           |   16 +++++++-----
 6 files changed, 59 insertions(+), 17 deletions(-)
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/0659.add_create_report_perms.sql


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list