From: Dan Wells Date: Fri, 3 Jun 2011 18:16:49 +0000 (-0400) Subject: Clean up a few stock perm mistakes, part 2 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=891d934fca3909043d31602a7d5de1d5ec699d9f;p=contrib%2FConifer.git Clean up a few stock perm mistakes, part 2 0547 did not completely apply to rel_2_1, so the correction of errant inserts from 0545 has been split off into this upgrade instead, for clarity. Signed-off-by: Dan Wells --- diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 1af405bf91..5ea5a861bc 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 ('0547', :eg_version); -- dbwells +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0548', :eg_version); -- dbwells CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/upgrade/0547.data.perm_list_cleanup.sql b/Open-ILS/src/sql/Pg/upgrade/0547.data.perm_list_cleanup.sql index 11d5d4faef..3ad43a41b9 100644 --- a/Open-ILS/src/sql/Pg/upgrade/0547.data.perm_list_cleanup.sql +++ b/Open-ILS/src/sql/Pg/upgrade/0547.data.perm_list_cleanup.sql @@ -2,13 +2,7 @@ BEGIN; SELECT evergreen.upgrade_deps_block_check('0547', :eg_version); -- dbwells --- delete errant inserts from 0545 (group 4 is NOT the circulation admin group) -DELETE FROM permission.grp_perm_map WHERE grp = 4 AND perm IN ( - SELECT id FROM permission.perm_list - WHERE code in ('ABORT_TRANSIT_ON_LOST', 'ABORT_TRANSIT_ON_MISSING') -); - --- now account for spelling errors (Admin != Administrator) +-- account for spelling errors (Admin != Administrator) \qecho This might not insert much if you passed through 0542 on your way here, \qecho but one group was missed there as well @@ -121,8 +115,6 @@ INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable) pgt.name = 'Circulation Administrator' AND aout.name = 'Consortium' AND perm.code IN ( - 'ABORT_TRANSIT_ON_LOST', - 'ABORT_TRANSIT_ON_MISSING', 'ADMIN_MAX_FINE_RULE', 'CREATE_CIRC_DURATION', 'DELETE_CIRC_DURATION', diff --git a/Open-ILS/src/sql/Pg/upgrade/0548.data.perm_list_cleanup_pt_2.sql b/Open-ILS/src/sql/Pg/upgrade/0548.data.perm_list_cleanup_pt_2.sql new file mode 100644 index 0000000000..96e887db26 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0548.data.perm_list_cleanup_pt_2.sql @@ -0,0 +1,35 @@ +BEGIN; + +SELECT evergreen.upgrade_deps_block_check('0548', :eg_version); -- dbwells + +\qecho This redoes the original part 1 of 0547 which did not apply to rel_2_1, +\qecho and is being added for the sake of clarity + +-- delete errant inserts from 0545 (group 4 is NOT the circulation admin group) +DELETE FROM permission.grp_perm_map WHERE grp = 4 AND perm IN ( + SELECT id FROM permission.perm_list + WHERE code in ('ABORT_TRANSIT_ON_LOST', 'ABORT_TRANSIT_ON_MISSING') +); + +INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable) + SELECT + pgt.id, perm.id, aout.depth, TRUE + FROM + permission.grp_tree pgt, + permission.perm_list perm, + actor.org_unit_type aout + WHERE + pgt.name = 'Circulation Administrator' AND + aout.name = 'Consortium' AND + perm.code IN ( + 'ABORT_TRANSIT_ON_LOST', + 'ABORT_TRANSIT_ON_MISSING' + ) AND NOT EXISTS ( + SELECT 1 + FROM permission.grp_perm_map AS map + WHERE + map.grp = pgt.id + AND map.perm = perm.id + ); + +COMMIT;