SIP2Gateway SIP DB configs
authorBill Erickson <berickxx@gmail.com>
Fri, 20 Mar 2020 21:39:45 +0000 (17:39 -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/sql/Pg/upgrade/XXXX.schema.sip-config.sql [new file with mode: 0644]

index a312c10..495910b 100644 (file)
@@ -13435,6 +13435,54 @@ SELECT  usr,
                </permacrud>
        </class>
 
+       <class id="csa" controller="open-ils.cstore open-ils.pcrud"
+               oils_obj:fieldmapper="config::sip_account" 
+               oils_persist:tablename="config.sip_account" 
+               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="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"/>
+                       <field name="workstation" reporter:datatype="link" reporter:label="Workstation"/>
+                       <field name="activity_type" reporter:datatype="link" reporter:label="Activity Type"/>
+                       <field name="av_format" reporter:datatype="text" reporter:label="SIP AV Format"/>
+               </fields>
+               <links>
+                       <link field="usr" reltype="has_a" key="id" map="" class="au"/>
+                       <link field="workstation" reltype="has_a" key="id" map="" class="aws"/>
+                       <link field="activity_type" reltype="has_a" key="id" map="" class="cuat"/>
+               </links>
+               <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+                       <actions>
+                               <create permission="SIP_ADMIN" global_required="true"/>
+                               <retrieve permission="SIP_ADMIN" global_required="true"/>
+                               <update permission="SIP_ADMIN" global_required="true"/>
+                               <delete permission="SIP_ADMIN" global_required="true"/>
+                       </actions>
+               </permacrud>
+       </class>
+
+       <class id="css" controller="open-ils.cstore open-ils.pcrud"
+               oils_obj:fieldmapper="config::sip_setting" 
+               oils_persist:tablename="config.sip_setting" 
+               reporter:label="SIP Settings">
+               <fields oils_persist:primary="id" oils_persist:sequence="config.sip_setting_id_seq">
+                       <field name="id" reporter:datatype="id" reporter:label="ID" reporter:selector="sip_username"/>
+                       <field name="institution" reporter:datatype="text" reporter:label="Institution" oils_obj:required="true"/>
+                       <field name="name" reporter:datatype="text" reporter:label="Institution" oils_obj:required="true"/>
+                       <field name="value" reporter:datatype="text" reporter:label="Institution" oils_obj:required="true"/>
+               </fields>
+               <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+                       <actions>
+                               <create permission="SIP_ADMIN" global_required="true"/>
+                               <retrieve permission="SIP_ADMIN" global_required="true"/>
+                               <update permission="SIP_ADMIN" global_required="true"/>
+                               <delete permission="SIP_ADMIN" global_required="true"/>
+                       </actions>
+               </permacrud>
+       </class>
+
        <!-- ********************************************************************************************************************* -->
 </IDL>
 
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
new file mode 100644 (file)
index 0000000..1d094d5
--- /dev/null
@@ -0,0 +1,46 @@
+
+BEGIN;
+
+-- SELECT evergreen.upgrade_deps_block_check('TODO', :eg_version);
+
+CREATE TABLE config.sip_account (
+    id              SERIAL PRIMARY KEY,
+    institution     TEXT NOT NULL,
+    sip_username    TEXT NOT NULL,
+    sip_password    BIGINT NOT NULL REFERENCES actor.passwd 
+                    DEFERRABLE INITIALLY DEFERRED,
+    usr             BIGINT NOT NULL REFERENCES actor.usr(id)
+                    DEFERRABLE INITIALLY DEFERRED,
+    workstation     INTEGER REFERENCES actor.workstation(id),
+    activity_type   INTEGER REFERENCES config.usr_activity_type(id),
+    av_format       TEXT -- e.g. '3m'
+);
+
+-- institution and global-level key/value setting pairs.
+CREATE TABLE config.sip_setting (
+    id SERIAL   PRIMARY KEY,
+    institution TEXT NOT NULL, -- '*' applies to all institutions
+    name        TEXT NOT NULL,
+    value       JSON NOT NULL,
+    CONSTRAINT  name_once_per_inst UNIQUE (institution, name)
+);
+
+-- SEED DATA
+
+INSERT INTO actor.passwd_type (code, name, login, crypt_algo, iter_count)
+    VALUES ('sip2', 'SIP2 Client Password', FALSE, 'bf', 5);
+
+/* EXAMPLE SETTINGS
+INSERT INTO config.sip_setting (institution, name, value)
+VALUES 
+    ('*',       'allow_sc_status_before_login', 'true'),
+    ('example', 'due_date_use_sip_date_format', 'false'),
+    ('example', 'patron_status_permit_loans', 'false'),
+    ('example', 'patron_status_permit_all', 'false'), 
+    ('example', 'msg64_hold_items_available', 'false')
+);
+*/
+
+COMMIT;
+
+