first steps to add IP range to org units user/csharp/add_ip_address_to_ou
authorChris Sharp <csharp@georgialibraries.org>
Wed, 15 Feb 2023 13:37:54 +0000 (08:37 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Wed, 15 Feb 2023 13:37:54 +0000 (08:37 -0500)
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/actor.pm
Open-ILS/src/sql/Pg/005.schema.actors.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.org_ip_range.sql [new file with mode: 0644]

index adacfda..bd92a3b 100644 (file)
@@ -7264,6 +7264,7 @@ SELECT  usr,
                        <field reporter:label="Settings" name="settings" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Addresses" name="addresses" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Checkins" name="checkins" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="IP Range" name="ip_range" reporter:datatype="link"/>
                        <field reporter:label="Workstations" name="workstations" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Fund Allocation Percentages" name="fund_alloc_pcts" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Copy Location Orders" name="copy_location_orders" oils_persist:virtual="true" reporter:datatype="link"/>
@@ -7302,6 +7303,7 @@ SELECT  usr,
                        <link field="rsrc_attrs" reltype="has_many" key="owner" map="" class="bra"/>
                        <link field="attr_vals" reltype="has_many" key="owner" map="" class="brav"/>
                        <link field="hours_of_operation" reltype="might_have" key="id" map="" class="aouhoo"/>
+                       <link field="ip_range" reltype="has_many" key="id" map="" class="aoipr"/>
                </links>
         <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
             <actions>
@@ -7312,6 +7314,22 @@ SELECT  usr,
             </actions>
         </permacrud>
        </class>
+       <class id="aoipr" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="actor::org_ip_range" oils_persist:tablename="actor.org_ip_range" reporter:label="Org Unit IP Range">
+               <fields oils_persist:primary="id" oils_persist:sequence="actor.org_ip_range_seq">
+                       <field reporter:label="ID" name="id" reporter:datatype="id"/>
+                       <field reporter:label="Organizational Unit" name="org_unit" reporter:datatype="org_unit"/>
+                       <field reporter:label="IP Range" name="ip_range" reporter:datatype="text"/>
+               </fields>
+               <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+                       <actions>
+                               <create permission="ADMIN_ORG_IP_RANGE"/>
+                               <retrieve/>
+                               <update permission="ADMIN_ORG_IP_RANGE"/>
+                               <delete permission="ADMIN_ORG_IP_RANGE"/>
+                       </actions>
+               </permacrud>
+       </class>
+
        <class id="aouct" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="actor::org_unit_custom_tree" oils_persist:tablename="actor.org_unit_custom_tree" reporter:label="Org Unit Custom Tree">
                <fields oils_persist:primary="id" oils_persist:sequence="actor.org_unit_custom_tree_id_seq">
                        <field reporter:label="ID" name="id" reporter:datatype="id"/>
index 6bf0481..e708da7 100644 (file)
@@ -82,7 +82,7 @@ use base qw/actor/;
 __PACKAGE__->table( 'actor_org_unit' );
 __PACKAGE__->columns( Primary => qw/id/);
 __PACKAGE__->columns( Essential => qw/parent_ou ou_type mailing_address billing_address
-                ill_address holds_address shortname name email phone opac_visible fiscal_calendar/);
+                ill_address holds_address shortname name email phone opac_visible fiscal_calendar ip_range/);
 
 #-------------------------------------------------------------------------------
 package actor::org_unit::hours_of_operation;
index 1c6fb9d..dc7de76 100644 (file)
@@ -323,6 +323,12 @@ CREATE TABLE actor.org_unit_type (
 );
 CREATE INDEX actor_org_unit_type_parent_idx ON actor.org_unit_type (parent);
 
+CREATE TABLE actor.org_ip_range (
+    id  SERIAL  PRIMARY KEY,
+    org_unit    INT REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED,
+    ip_range    CIDR    NOT NULL
+);
+
 CREATE TABLE actor.org_unit (
        id              SERIAL  PRIMARY KEY,
        parent_ou       INT     REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED,
@@ -331,6 +337,7 @@ CREATE TABLE actor.org_unit (
        holds_address   INT,
        mailing_address INT,
        billing_address INT,
+    ip_range    INT REFERENCES actor.org_ip_range (id) DEFERRABLE INITIALLY DEFERRED,
        shortname       TEXT    NOT NULL UNIQUE,
        name            TEXT    NOT NULL UNIQUE,
        email           TEXT,
@@ -344,6 +351,7 @@ CREATE INDEX actor_org_unit_ill_address_idx ON actor.org_unit (ill_address);
 CREATE INDEX actor_org_unit_billing_address_idx ON actor.org_unit (billing_address);
 CREATE INDEX actor_org_unit_mailing_address_idx ON actor.org_unit (mailing_address);
 CREATE INDEX actor_org_unit_holds_address_idx ON actor.org_unit (holds_address);
+CREATE INDEX actor_org_unit_ip_range_idx ON actor.org_unit (ip_range);
 
 CREATE OR REPLACE FUNCTION actor.org_unit_parent_protect () RETURNS TRIGGER AS $$
        DECLARE
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.org_ip_range.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.org_ip_range.sql
new file mode 100644 (file)
index 0000000..9f7fe54
--- /dev/null
@@ -0,0 +1,12 @@
+BEGIN;
+
+CREATE TABLE actor.org_ip_range (
+    id  SERIAL  PRIMARY KEY,
+    org_unit    INT REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED,
+    ip_range    CIDR    NOT NULL
+);
+
+ALTER TABLE actor.org_unit ADD COLUMN  ip_range    INT REFERENCES actor.org_ip_range (id) DEFERRABLE INITIALLY DEFERRED;
+CREATE INDEX actor_org_unit_ip_range_idx ON actor.org_unit (ip_range);
+
+COMMIT;