From: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Date: Tue, 26 Jul 2011 15:21:20 +0000 (-0400)
Subject: Add the PERSISTENT_LOGIN permission to the system, and ...
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0c14de3649c51dd04b236c4b4f8ce6df97686fda;p=evergreen%2Fmasslnc.git

Add the PERSISTENT_LOGIN permission to the system, and ...

... make it belong to Users (which includes Staff and Patrons) by
default.

This doesn't mean that all logins are persistent (long-lived) by
default, it just means that users do have the permission to request a
long-lived auth session by default.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
---

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 55bcc41949..95f4f34964 100644
--- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql
+++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
@@ -1432,7 +1432,9 @@ INSERT INTO permission.perm_list ( id, code, description ) VALUES
  ( 509, 'TRANSIT_CHECKIN_INTERVAL_BLOCK.override', oils_i18n_gettext(509,
     'Allows a user to override the TRANSIT_CHECKIN_INTERVAL_BLOCK event', 'ppl', 'description')),
  ( 510, 'UPDATE_PATRON_COLLECTIONS_EXEMPT', oils_i18n_gettext(510,
-    'Allows a user to indicate that a patron is exempt from collections processing', 'ppl', 'description'));
+    'Allows a user to indicate that a patron is exempt from collections processing', 'ppl', 'description')),
+ ( 511, 'PERSISTENT_LOGIN', oils_i18n_gettext( 511,
+    'Allows a user to authenticate and get a long-lived session (length configured in opensrf.xml)', 'ppl', 'description' ));
 
 
 SELECT SETVAL('permission.perm_list_id_seq'::TEXT, 1000);
@@ -1502,6 +1504,7 @@ INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable)
 			'CREATE_PURCHASE_REQUEST',
 			'MR_HOLDS',
 			'OPAC_LOGIN',
+			'PERSISTENT_LOGIN',
 			'RENEW_CIRC',
 			'TITLE_HOLDS',
 			'user_request.create'
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.persistent_login_default_perm.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.persistent_login_default_perm.sql
new file mode 100644
index 0000000000..022537a558
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.persistent_login_default_perm.sql
@@ -0,0 +1,35 @@
+BEGIN;
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT INTO permission.perm_list (id, code, description) VALUES (
+    511,
+    'PERSISTENT_LOGIN',
+    oils_i18n_gettext(
+        511,
+        'Allows a user to authenticate and get a long-lived session (length configured in opensrf.xml)',
+        'ppl',
+        'description'
+    )
+);
+
+INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable)
+    SELECT
+        pgt.id, perm.id, aout.depth, FALSE
+    FROM
+        permission.grp_tree pgt,
+        permission.perm_list perm,
+        actor.org_unit_type aout
+    WHERE
+        pgt.name = 'Users' AND
+        aout.name = 'Consortium' AND
+        perm.code = 'PERSISTENT_LOGIN';
+
+\qecho 
+\qecho If this transaction succeeded, your users (staff and patrons) now have
+\qecho the PERSISTENT_LOGIN permission by default.
+\qecho 
+
+COMMIT;
+