[open-ils-commits] r352 - conifer/trunk/tools/migration-scripts (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Apr 17 16:09:07 EDT 2009
Author: dbs
Date: 2009-04-17 16:09:02 -0400 (Fri, 17 Apr 2009)
New Revision: 352
Added:
conifer/trunk/tools/migration-scripts/patron_groups.sql
Log:
Basic cut at permissions and patron groups for Conifer
Added: conifer/trunk/tools/migration-scripts/patron_groups.sql
===================================================================
--- conifer/trunk/tools/migration-scripts/patron_groups.sql (rev 0)
+++ conifer/trunk/tools/migration-scripts/patron_groups.sql 2009-04-17 20:09:02 UTC (rev 352)
@@ -0,0 +1,86 @@
+BEGIN;
+
+-- Set up patron groups and permissions
+
+INSERT INTO permission.grp_tree (name, parent, usergroup, perm_interval, description, application_perm) VALUES ('Faculty', 2, 't', '1 year', 'Faculty', 'group_application.user.patron');
+INSERT INTO permission.grp_tree (name, parent, usergroup, perm_interval, description, application_perm) VALUES ('Graduate', 2, 't', '1 year', 'Graduate', 'group_application.user.patron');
+INSERT INTO permission.grp_tree (name, parent, usergroup, perm_interval, description, application_perm) VALUES ('Undergraduate', 2, 't', '1 year', 'Undergraduate', 'group_application.user.patron');
+INSERT INTO permission.grp_tree (name, parent, usergroup, perm_interval, description, application_perm) VALUES ('Readers', 2, 't', '1 year', 'Readers', 'group_application.user.patron');
+
+-- (11 = Faculty, 12 = Graduate, 13 = Undergraduate, 14 = Reader)
+
+INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable)
+ SELECT 11, perm, depth, grantable FROM permission.grp_perm_map
+ WHERE grp = 2;
+
+INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable)
+ SELECT 12, perm, depth, grantable FROM permission.grp_perm_map
+ WHERE grp = 2;
+
+INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable)
+ SELECT 13, perm, depth, grantable FROM permission.grp_perm_map
+ WHERE grp = 2;
+
+INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable)
+ SELECT 14, perm, depth, grantable FROM permission.grp_perm_map
+ WHERE grp = 2;
+
+-- Not really necessary, unless you want to restrict the ability to add
+INSERT INTO permission.perm_list (code, description) VALUES
+ ('group_application.user.patron.faculty', 'Allow a user to add/remove users to/from the "Faculty" group'),
+ ('group_application.user.patron.grad', 'Allow a user to add/remove users to/from the "Graduate students" group'),
+ ('group_application.user.patron.undergrad', 'Allow a user to add/remove users to/from the "Undergraduate students" group');
+
+-- Give circulators the ability to abort transits
+-- ABORT_TRANSIT = perm 111, ABORT_REMOTE_TRANSIT = perm 112
+INSERT INTO permission.grp_perm_map (grp, perm, depth)
+ VALUES (5, 111, 2), (5, 112, 2);
+
+-- Enable all staff to cancel holds
+INSERT INTO permission.grp_perm_map (grp, perm, depth)
+ VALUES (3, 114, 0);
+
+-- Enable cataloguers to import bib records
+-- Cataloguer profile group = 4
+-- Depth (how much of the org_tree does the user have this permission
+over) = 0 (the whole thing)
+INSERT INTO permission.grp_perm_map (grp, depth, perm)
+ SELECT 4, 0, id from permission.perm_list
+ WHERE code LIKE '%IMPORT%' AND id NOT IN (
+ SELECT perm FROM permission.grp_perm_map
+ WHERE grp = 4
+ )
+;
+
+-- Grant ability to merge bib records to cataloguers
+INSERT INTO permission.grp_perm_map (grp, perm, depth)
+ VALUES (4, 230, 0);
+
+-- Grant ability to delete bib records to cataloguers
+INSERT INTO permission.grp_perm_map (grp, perm, depth)
+ VALUES (4, 153, 0);
+
+-- Grant ability to add, delete, or update closing dates
+INSERT INTO permission.grp_perm_map (grp, perm, depth)
+ VALUES (10, 117, 1), (10, 116, 1), (10, 118, 1);
+
+-- Restrict visibility of patrons to staff in related institutions
+UPDATE permission.grp_perm_map SET depth = 2
+ WHERE grp = 3 AND perm = 31;
+
+-- New circ rules, to match our JavaScript
+INSERT INTO config.rule_circ_duration (name, extended, normal, shrt, max_renewals)
+ VALUES ('120_days_2_renew', '120 days', '120 days', '120 days', 2),
+ ('3_weeks_2_renew', '3 weeks', '3 weeks', '3 weeks', 2);
+
+-- Give local system administrators any permissions other staff have
+INSERT INTO permission.grp_perm_map (grp, depth, perm)
+ SELECT DISTINCT 10, 2, perm
+ FROM permission.grp_perm_map
+ WHERE grp IN (3, 4, 5) AND perm NOT IN (
+ SELECT perm
+ FROM permission.grp_perm_map
+ WHERE grp = 10
+ )
+;
+COMMIT;
More information about the open-ils-commits
mailing list