From 90f5f2031e11f0e2847571a6b3715d421b88c6ca Mon Sep 17 00:00:00 2001 From: Chris Sharp Date: Thu, 11 Feb 2021 10:33:58 -0500 Subject: [PATCH] Add GALILEO URL base as an org unit setting Signed-off-by: Chris Sharp --- .../src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm | 9 +++++--- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 20 +++++++++++++++++ .../upgrade/XXXX.data.galileo_url_ou_setting.sql | 26 ++++++++++++++++++++++ 3 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.data.galileo_url_ou_setting.sql diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index 5388326c33..6f258314ef 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -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); } 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 3d587dcec8..cacc9b14ff 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -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 index 0000000000..fba879f43c --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.galileo_url_ou_setting.sql @@ -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; -- 2.11.0