Add GALILEO URL base as an org unit setting
authorChris Sharp <csharp@georgialibraries.org>
Thu, 11 Feb 2021 15:33:58 +0000 (10:33 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Thu, 11 Feb 2021 15:33:58 +0000 (10:33 -0500)
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.data.galileo_url_ou_setting.sql [new file with mode: 0644]

index 5388326..6f25831 100644 (file)
@@ -739,15 +739,18 @@ sub _perform_any_sso_signout_required {
 
 sub load_galileo {
     my $self = shift;
-
+   
+    my $galileo_url_base = $self->ctx->{get_org_setting}->($org_unit, 'opac.galileo_url_base');
+    
     my $token = $U->simplereq(
         'open-ils.actor',
         'open-ils.actor.session.safe_token',
         $self->ctx->{authtoken}
     );
 
-    return $self->generic_redirect(
-        "http://www.galileo.usg.edu/express?pinesid=$token");
+    my $galileo_url = $galileo_url_base . "express?pinesid=" . $token;
+
+    return $self->generic_redirect($galileo_url);
 }
 
 
index 3d587dc..cacc9b1 100644 (file)
@@ -1949,6 +1949,8 @@ INSERT INTO permission.perm_list ( id, code, description ) VALUES
     'View booking reservations', 'ppl', 'description')),
  ( 626, 'VIEW_BOOKING_RESERVATION_ATTR_MAP', oils_i18n_gettext(626,
     'View booking reservation attribute maps', 'ppl', 'description'))
+ ( 2001, 'UPDATE_GALILEO_URL', oils_i18n_gettext(2001,
+    'Set or update the GALILEO URL for PINES login', 'ppl', 'description'))
 ;
 
 
@@ -21292,4 +21294,22 @@ VALUES
     (3,'fullname')
 ;
 
+INSERT into config.org_unit_setting_type
+    ( name, grp, label, description, datatype, update_perm )
+VALUES (
+    'opac.galileo_url_base', 'opac',
+    oils_i18n_gettext(
+    'opac.galileo_url_base',
+    'GALILEO base URL',
+    'coust', 'label'),
+    oils_i18n_gettext('opac.galileo_url_base',
+    'Base URL for GALILEO login feature.  Example: https://www.galileo.usg.edu/ for production or https://gs-staging.galileo.usg.edu/ for testing',
+    'coust', 'description'),
+    'string', 2001
+);
+
+-- since this is really just for PINES, let's insert a default value
+INSERT INTO actor.org_unit_setting (org_unit, name, value) values (1, 'opac.galileo_url_base', 'https://www.galileo.usg.edu/');
 
+-- and give GlobalAdmin the perm
+INSERT INTO permission.grp_perm_map (grp, perm, depth) values ((select id from permission.grp_tree where name = 'GlobalAdmin'), 2001, 0);
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.galileo_url_ou_setting.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.galileo_url_ou_setting.sql
new file mode 100644 (file)
index 0000000..fba879f
--- /dev/null
@@ -0,0 +1,26 @@
+BEGIN;
+
+INSERT INTO permission.perm_list ( id, code, description ) VALUES ( 2001, 'UPDATE_GALILEO_URL', oils_i18n_gettext(2001,
+    'Set or update the GALILEO URL for PINES login', 'ppl', 'description'));
+
+INSERT into config.org_unit_setting_type
+    ( name, grp, label, description, datatype, update_perm )
+VALUES (
+    'opac.galileo_url_base', 'opac',
+    oils_i18n_gettext(
+    'opac.galileo_url_base',
+    'GALILEO base URL',
+    'coust', 'label'),
+    oils_i18n_gettext('opac.galileo_url_base',
+    'Base URL for GALILEO login feature.  Example: https://www.galileo.usg.edu/ for production or https://gs-staging.galileo.usg.edu/ for testing',
+    'coust', 'description'),
+    'string', 2001
+);
+
+-- since this is really just for PINES, let's insert a default value
+INSERT INTO actor.org_unit_setting (org_unit, name, value) values (1, 'opac.galileo_url_base', 'https://www.galileo.usg.edu/');
+
+-- and give GlobalAdmin the perm
+INSERT INTO permission.grp_perm_map (grp, perm, depth) values ((select id from permission.grp_tree where name = 'GlobalAdmin'), 2001, 0);
+
+COMMIT;