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,
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
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',
--- /dev/null
+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;