From: Bill Erickson Date: Wed, 25 Nov 2020 19:26:29 +0000 (-0800) Subject: LP1901930 SIP mediator continued X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=56b342319c32de3337e55c2d6ae38a81dc5ec3d0;p=working%2FEvergreen.git LP1901930 SIP mediator continued Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/examples/opensrf.xml.example b/Open-ILS/examples/opensrf.xml.example index 5eecd0051e..ca867186e5 100644 --- a/Open-ILS/examples/opensrf.xml.example +++ b/Open-ILS/examples/opensrf.xml.example @@ -1376,12 +1376,9 @@ vim:et:ts=4:sw=4: open-ils.serial open-ils.hold-targeter open-ils.ebook_api -<<<<<<< HEAD open-ils.courses open-ils.curbside -======= open-ils.sip2 ->>>>>>> migrating top sip2 service diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2.pm index 2fce9f2106..887de63b7c 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2.pm @@ -157,10 +157,23 @@ sub handle_sc_status { $config = $session->config; } else { - # TODO: where should the 'allow_sc_status_before_login' setting - # live, since we don't yet have an institution configuration loaded? - # TODO: Do we need a 'default institution' setting? - $config = {id => 'NONE', supports => [], settings => {}}; + + # Confirm sc-status-before-login is enabled before continuing. + + my $flag = new_editor()->search_config_global_flag({ + name => 'sip.sc_status_before_login_institution', + value => {'!=' => undef}, + enabled => 't', + })->[0]; + + return OpenILS::Event->new( + 'SC_STATUS_REQUIRES_LOGIN', {payload => $message}) unless $flag; + + $config = { + settings => {}, + id => $flag->value, + supports => OpenILS::Application::SIPSession->supports + }; } my $response = { diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2/Session.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2/Session.pm index 3639eaa65b..88c975139b 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2/Session.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2/Session.pm @@ -40,6 +40,10 @@ sub new { return bless(\%args, $class); } +sub supports { + return INSTITUTION_SUPPORTS; +} + sub config { my $self = shift; return $self->{config} if $self->{config}; diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.sip-config.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.sip-config.sql index 6cc27778ea..2427435962 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.sip-config.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.sip-config.sql @@ -66,6 +66,17 @@ INSERT INTO sip.setting_group (id, label, institution) -- carve space for other canned setting groups SELECT SETVAL('sip.setting_group_id_seq'::TEXT, 1000); +-- has to be global since settings are linked to accounts and if +-- status-before-login is used, no account information will be available. +INSERT INTO config.global_flag (name, value, enabled, label) VALUES +( 'sip.sc_status_before_login_institution', NULL, FALSE, + oils_i18n_gettext( + 'sip.sc_status_before_login_institution', + 'Activate status-before-login-support and define the institution ' || + 'value which should be used in the response', + 'cgf', 'label') +); + INSERT INTO sip.setting (setting_group, name, value, description) VALUES ( 1, 'currency', '"USD"', @@ -80,12 +91,6 @@ VALUES ( 'AV Format. Options: eg_legacy, 3m, swyer_a, swyer_b', 'sipset', 'description') ), ( - 1, 'allow_sc_status_before_login', 'true', - oils_i18n_gettext( - (SELECT id FROM sip.setting WHERE name = 'allow_sc_status_before_login'), - 'Allow clients to request the SIP server status before login (message 99)', - 'sipset', 'description') -), ( 1, 'due_date_use_sip_date_format', 'false', oils_i18n_gettext( (SELECT id FROM sip.setting WHERE name = 'due_date_use_sip_date_format'),