SIP2Mediator account mgmt cont
authorBill Erickson <berickxx@gmail.com>
Tue, 1 Sep 2020 19:50:36 +0000 (15:50 -0400)
committerBill Erickson <berickxx@gmail.com>
Wed, 28 Oct 2020 18:57:39 +0000 (14:57 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/perlmods/lib/OpenILS/WWW/SIP2Gateway.pm
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.sip-config.sql

index cb2b244..72fb487 100644 (file)
@@ -13441,6 +13441,7 @@ SELECT  usr,
                reporter:label="SIP AccountS">
                <fields oils_persist:primary="id" oils_persist:sequence="config.sip_account_id_seq">
                        <field name="id" reporter:datatype="id" reporter:label="ID" reporter:selector="sip_username"/>
+                       <field name="enabled" reporter:datatype="bool" reporter:label="Enabled"/>
                        <field name="institution" reporter:datatype="text" reporter:label="Institution" oils_obj:required="true"/>
                        <field name="sip_username" reporter:datatype="text" reporter:label="SIP Username" oils_obj:required="true"/>
                        <field name="usr" reporter:datatype="link" reporter:label="ILS User" oils_obj:required="true"/>
index 11428f0..294ba62 100644 (file)
@@ -179,12 +179,8 @@ sub init {
     my $e = new_editor();
 
     my $settings = $e->retrieve_all_config_sip_setting;
-    my $accounts = $e->search_config_sip_account([
-        {id => {'!=' => undef}},
-        {flesh => 1, flesh_fields => {csa => ['workstation']}}
-    ]);
 
-    $config = {institutions => [], accounts => $accounts};
+    $config = {institutions => []};
 
     # Institution specific settings.
     # In addition to the settings, this tells us what institutions we support.
@@ -333,9 +329,10 @@ sub handle_login {
 
     my $sip_username = get_field_value($message, 'CN');
     my $sip_password = get_field_value($message, 'CO');
-
-    my ($sip_account) = 
-        grep {$_->sip_username eq $sip_username} @{$config->{accounts}};
+    my $sip_account = new_editor()->search_config_sip_account([
+        {sip_username => $sip_username, enabled => 't'}, 
+        {flesh => 1, flesh_fields => {csa => ['workstation']}}
+    ])->[0];
 
     if (!$sip_account) {
         $logger->warn("SIP2: No such SIP account: $sip_username");
index fb7c304..9b8567e 100644 (file)
@@ -5,6 +5,7 @@ BEGIN;
 
 CREATE TABLE config.sip_account (
     id              SERIAL PRIMARY KEY,
+    enabled         BOOLEAN NOT NULL DEFAULT TRUE,
     institution     TEXT NOT NULL,
     sip_username    TEXT NOT NULL,
     sip_password    BIGINT NOT NULL REFERENCES actor.passwd