LP1901930 SIP mediator continued
authorBill Erickson <berickxx@gmail.com>
Wed, 25 Nov 2020 19:26:29 +0000 (11:26 -0800)
committerBill Erickson <berickxx@gmail.com>
Mon, 30 Nov 2020 16:38:26 +0000 (08:38 -0800)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/examples/opensrf.xml.example
Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2/Session.pm
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.sip-config.sql

index 5eecd00..ca86718 100644 (file)
@@ -1376,12 +1376,9 @@ vim:et:ts=4:sw=4:
                 <appname>open-ils.serial</appname>  
                 <appname>open-ils.hold-targeter</appname>  
                 <appname>open-ils.ebook_api</appname>
-<<<<<<< HEAD
                 <appname>open-ils.courses</appname>
                 <appname>open-ils.curbside</appname>
-=======
                 <appname>open-ils.sip2</appname>
->>>>>>> migrating top sip2 service
             </activeapps>
         </localhost>
     </hosts>
index 2fce9f2..887de63 100644 (file)
@@ -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 = {
index 3639eaa..88c9751 100644 (file)
@@ -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};
index 6cc2777..2427435 100644 (file)
@@ -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'),