Changeset 3546 for cats/ISOcat


Ignore:
Timestamp:
09/10/13 12:06:47 (11 years ago)
Author:
mwindhouwer
Message:

M mod-ISOcat-access-data/schemas/DCIF-1_3.rng

  • made the lax version even more lax

M mod-ISOcat-access-data/dbms/ISOcat-schema-views.sql

  • include the owner in the access info

M mod-ISOcat-access-data/dbx/DCIF.xml

  • skip over an empty note

M mod-ISOcat-manage-system/manage/import.acc
M mod-ISOcat-manage-system/manage/import-batch.acc

  • can do a lax or strict validation
  • can now forcefully import an invalid DCIF
  • will now check access rights of the change owner
  • can update only owned or also shared DCs
Location:
cats/ISOcat/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • cats/ISOcat/trunk/mod-ISOcat-access-data/dbms/ISOcat-schema-views.sql

    r2029 r3546  
    457457FROM
    458458(
     459( -- the owner with access rights
     460SELECT
     461        id AS dcs,
     462        "owner" AS account,
     463        'rud'::access_rights_enum AS rights,
     464        NULL AS propagate,
     465        'owner' AS "type"
     466FROM
     467        core_data_category_selection
     468)
     469UNION
    459470( -- all users with access rights
    460471SELECT
     
    512523AS SELECT access.dc, access.account, access.type, max(access.rights) AS rights
    513524   FROM (
     525           (
     526                SELECT id AS dc,"owner" AS account, 'ru'::access_rights_enum AS rights, 'owner' AS type
     527                FROM core_data_category
     528           )
     529        UNION
    514530           ( -- user/group access rights directly on the DC
    515531                   (
     
    543559;
    544560
     561
    545562CREATE OR REPLACE VIEW
    546563  view_link_dcs_access
  • cats/ISOcat/trunk/mod-ISOcat-access-data/dbx/DCIF.xml

    r3458 r3546  
    554554                                                                                                                        <dbx:where field="text_type"  value="note" type="string"/>
    555555                                                                                                                        <dbx:sort field="id"/>
    556                                                                                                                         <dcif:note isocat:id="{$current/id}" dbx:field="text" dcr:datcat="http://www.isocat.org/datcat/DC-36">
     556                                                                                                                        <dcif:note isocat:id="{$current/id}" dbx:field="text" dcr:datcat="http://www.isocat.org/datcat/DC-36" dbx:when="normalize-space(.)!=''">
    557557                                                                                                                                <dbx:attribute name="xml:lang" select="$core_language//row[id=$current/language]/tag"/>
    558558                                                                                                                                <dbx:attribute name="isocat:direction" select="$core_language//row[id=$current/language]/direction"/>
  • cats/ISOcat/trunk/mod-ISOcat-access-data/schemas/DCIF-1_3.rng

    r3543 r3546  
    308308                                                        </optional>
    309309                                                        <data type="string">
    310                                                                 <param name="pattern">.*[\S].*</param>
     310                                                                <xrng:strict>
     311                                                                        <param name="pattern">.*[\S].*</param>
     312                                                                </xrng:strict>
    311313                                                        </data>
    312314                                                </element>
     
    328330                                                                        </attribute>
    329331                                                                </optional>
    330                                                                 <data type="string"/>                                                           
     332                                                                <data type="string"/>
    331333                                                        </element>
    332334                                                </interleave>
     
    390392                                                                <ref name="anyAttributes"/>
    391393                                                                <data type="string">
    392                                                                         <param name="pattern">.*[\S].*</param>
     394                                                                        <xrng:strict>
     395                                                                                <param name="pattern">.*[\S].*</param>
     396                                                                        </xrng:strict>
    393397                                                                </data>
    394398                                                        </element>
  • cats/ISOcat/trunk/mod-ISOcat-manage-system/manage/import-batch.acc

    r2906 r3546  
    498498                                                                                                                <xsl:apply-templates select="node()"/>
    499499                                                                                                                <xsl:choose>
    500                                                                                                                         <xsl:when test="exists(dcif:lastChange)">
     500                                                                                                                        <xsl:when test="exists(dcif:lastChange[normalize-space(@isocat:id)=''])">
    501501                                                                                                                                <isocat:change>
    502502                                                                                                                                        <xsl:value-of select="dcif:lastChange/dcif:changeDescription"/>
  • cats/ISOcat/trunk/mod-ISOcat-manage-system/manage/import.acc

    r3515 r3546  
    1 <accessor debug="false" trace="false" deadlock="true">
     1<accessor debug="true" trace="false" deadlock="true">
    22        <name>/isocat/manage/import</name>
    33        <descr>Import a DCIF document into the registry</descr>
     
    5757                </source>
    5858        </param>
     59        <param>
     60                <name>validation-mode</name>
     61                <descr>validation mode</descr>
     62                <type canonical="true">string</type>
     63                <source>
     64                        <nvp/>
     65                        <default>
     66                                <string>strict</string>
     67                        </default>
     68                </source>
     69        </param>
     70        <param>
     71                <name>shared</name>
     72                <descr>also update shared DCs</descr>
     73                <type canonical="true">string</type>
     74                <source>
     75                        <nvp/>
     76                        <default>
     77                                <string>false</string>
     78                        </default>
     79                </source>
     80        </param>
    5981        <params/>
    6082        <idoc>
     
    271293                                        <target>var:loc</target>
    272294                                </instr>
    273                                 <instr>
    274                                         <type>validateRNG</type>
    275                                         <operand>curi:var:loc</operand>
    276                                         <operator>active:ISOcat.access.data.dcif.schema</operator>
    277                                         <target>var:valid</target>
    278                                 </instr>
     295                                <if>
     296                                        <cond>
     297                                                <instr>
     298                                                        <type>sloot.xpath2eval</type>
     299                                                        <operand>var:validation-mode</operand>
     300                                                        <operator>
     301                                                                <xpath>.='lax'</xpath>
     302                                                        </operator>
     303                                                        <target>this:cond</target>
     304                                                </instr>
     305                                        </cond>
     306                                        <then>
     307                                                <instr>
     308                                                        <type>validateRNG</type>
     309                                                        <operand>curi:var:loc</operand>
     310                                                        <operator>active:ISOcat.access.data.dcif.schema.lax</operator>
     311                                                        <target>var:valid</target>
     312                                                </instr>
     313                                        </then>
     314                                        <else>
     315                                                <instr>
     316                                                        <type>validateRNG</type>
     317                                                        <operand>curi:var:loc</operand>
     318                                                        <operator>active:ISOcat.access.data.dcif.schema</operator>
     319                                                        <target>var:valid</target>
     320                                                </instr>
     321                                        </else>
     322                                </if>
    279323                                <!-- dump the validation result -->
    280324                                <instr>
     
    298342                                                <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
    299343                                                        <xsl:param name="valid"/>
     344                                                        <xsl:param name="validation-mode"/>
    300345                                                        <xsl:template match="@*|node()">
    301346                                                                <xsl:copy>
     
    305350                                                        <xsl:template match="valid">
    306351                                                                <xsl:copy>
     352                                                                        <xsl:choose>
     353                                                                                <xsl:when test="$validation-mode='lax'">
     354                                                                                        <xsl:attribute name="mode" select="'lax'"/>
     355                                                                                </xsl:when>
     356                                                                                <xsl:otherwise>
     357                                                                                        <xsl:attribute name="mode" select="'strict'"/>
     358                                                                                </xsl:otherwise>
     359                                                                        </xsl:choose>
    307360                                                                        <xsl:copy-of select="$valid"/>
    308361                                                                </xsl:copy>
     
    311364                                        </operator>
    312365                                        <valid>var:valid</valid>
     366                                        <validation-mode>var:validation-mode</validation-mode>
    313367                                        <target>var:status</target>
    314368                                </instr>
     
    332386                                        <operand>var:action</operand>
    333387                                        <operator>
    334                                                 <xpath>.='check'</xpath>
     388                                                <xpath>.=('check','forced check')</xpath>
    335389                                        </operator>
    336390                                        <target>this:cond</target>
     
    356410                                                        exclude-result-prefixes="dcif"
    357411                                                >
     412                                                        <xsl:param name="status"/>
     413                                                        <xsl:param name="shared"/>
    358414                                                        <xsl:template match="text()"/>
    359415                                                        <xsl:template match="/dcif:dataCategorySelection">
     
    380436                                                                                                --THEN 'update'
    381437                                                                                                --ELSE 'revision'
    382                                                                                                 ELSE 'update'
     438                                                                                                WHEN owner_id = <xsl:value-of select="$status//owner//id"/>
     439                                                                                                THEN 'update'
     440                                                                                                WHEN rights::text LIKE '%u%'
     441                                                                                                THEN 'update'
     442                                                                                                ELSE 'select'
    383443                                                                                        END AS action
    384444                                                                                FROM
     
    388448                                                                                ON
    389449                                                                                        view_data_category.pid = DCIFimport.pid
     450                                                                                LEFT JOIN
     451                                                                                        view_dc_access
     452                                                                                ON
     453                                                                                        view_dc_access.dc = view_data_category.id
     454                                                                                  AND
     455                                                                                        view_dc_access.account = <xsl:value-of select="$status//owner//id"/>
     456                                                                                  AND
     457                                                                                    view_dc_access."type" = '<xsl:value-of select="if ($shared='true') then ('user') else ('owner')"/>'
    390458                                                                                ORDER BY tpe DESC
    391459                                                                                ;
     
    413481                                                </xsl:stylesheet>
    414482                                        </operator>
     483                                        <status>var:status</status>
     484                                        <shared>var:shared</shared>
    415485                                        <target>var:sql</target>
    416486                                </instr>
     
    564634                                        <operator>
    565635                                                <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
     636                                                        <xsl:param name="action"/>
    566637                                                        <xsl:param name="check"/>
     638                                                        <xsl:param name="shared"/>
    567639                                                        <xsl:template match="@*|node()">
    568640                                                                <xsl:copy>
     
    572644                                                        <xsl:template match="check">
    573645                                                                <xsl:copy>
     646                                                                        <xsl:choose>
     647                                                                                <xsl:when test="$action='forced check'">
     648                                                                                        <xsl:attribute name="forced" select="'true'"/>
     649                                                                                </xsl:when>
     650                                                                                <xsl:otherwise>
     651                                                                                        <xsl:attribute name="forced" select="'false'"/>
     652                                                                                </xsl:otherwise>
     653                                                                        </xsl:choose>
     654                                                                        <xsl:attribute name="shared" select="$shared"/>
    574655                                                                        <xsl:copy-of select="$check"/>
    575656                                                                </xsl:copy>
     
    577658                                                </xsl:stylesheet>
    578659                                        </operator>
     660                                        <action>var:action</action>
    579661                                        <check>var:check</check>
     662                                        <shared>var:shared</shared>
    580663                                        <target>var:status</target>
    581664                                </instr>
     
    9511034                                                                                                <xsl:choose>
    9521035                                                                                                        <xsl:when test="$valid">
    953                                                                                                                 <xsl:text>valid</xsl:text>
     1036                                                                                                                <xsl:text>valid (</xsl:text>
     1037                                                                                                                <xsl:value-of select="valid/@mode"/>
     1038                                                                                                                <xsl:text>)</xsl:text>
    9541039                                                                                                        </xsl:when>
    9551040                                                                                                        <xsl:when test="valid/b/(text())[1]='f'">
    956                                                                                                                 <b>invalid</b>
     1041                                                                                                                <b>
     1042                                                                                                                        <xsl:text>invalid (</xsl:text>
     1043                                                                                                                        <xsl:value-of select="valid/@mode"/>
     1044                                                                                                                        <xsl:text>)</xsl:text>
     1045                                                                                                                </b>
    9571046                                                                                                                <!-- show warnings/errors -->
    9581047                                                                                                                <div>
     
    9931082                                                                                        </td>
    9941083                                                                                        <td valign="top">
    995                                                                                                 <button type="submit" name="action" value="validate">validate DCIF</button>
     1084                                                                                                <button type="submit" name="action" value="validate">
     1085                                                                                                        <xsl:if test="not($owned)">
     1086                                                                                                                <xsl:attribute name="disabled" select="'disabled'"/>
     1087                                                                                                        </xsl:if>                                                                                                       
     1088                                                                                                        <xsl:text>validate DCIF</xsl:text>
     1089                                                                                                </button>
     1090                                                                                                <input type="checkbox" name="validation-mode" value="lax">
     1091                                                                                                        <xsl:if test="not($owned)">
     1092                                                                                                                <xsl:attribute name="disabled" select="'disabled'"/>
     1093                                                                                                        </xsl:if>                                                                                                       
     1094                                                                                                        <xsl:if test="valid/@mode='lax'">
     1095                                                                                                                <xsl:attribute name="checked" select="'checked'"/>
     1096                                                                                                        </xsl:if>
     1097                                                                                                </input>
     1098                                                                                                <xsl:text>&#160;</xsl:text>
     1099                                                                                                <span>lax</span>
    9961100                                                                                        </td>
    9971101                                                                                </tr>
    9981102                                                                                <tr>
    999                                                                                         <td valign="top">Check </td>
     1103                                                                                        <td valign="top">
     1104                                                                                                <xsl:text>Check</xsl:text>
     1105                                                                                                <xsl:if test="check/@forced='true'">
     1106                                                                                                        <xsl:text> (forced)</xsl:text>
     1107                                                                                                </xsl:if>
     1108                                                                                        </td>
    10001109                                                                                        <td>
    10011110                                                                                                <xsl:choose>
     
    10191128                                                                                        </td>
    10201129                                                                                        <td valign="top">
    1021                                                                                                 <button type="submit" name="action" value="check">
    1022                                                                                                         <xsl:if test="not($owned) or not($valid)">
     1130                                                                                                <button type="submit" name="action">
     1131                                                                                                        <xsl:choose>
     1132                                                                                                                <xsl:when test="not($owned) or normalize-space(valid)=''">
     1133                                                                                                                        <xsl:attribute name="value" select="'check'"/>
     1134                                                                                                                        <xsl:attribute name="disabled" select="'disabled'"/>
     1135                                                                                                                        <xsl:text>check actions</xsl:text>
     1136                                                                                                                </xsl:when>
     1137                                                                                                                <xsl:when test="valid/b/(text())[1]='f'">
     1138                                                                                                                        <xsl:attribute name="value" select="'forced check'"/>
     1139                                                                                                                        <xsl:text>check actions (forced)</xsl:text>
     1140                                                                                                                </xsl:when>
     1141                                                                                                                <xsl:otherwise>
     1142                                                                                                                        <xsl:attribute name="value" select="'check'"/>
     1143                                                                                                                        <xsl:text>check actions</xsl:text>
     1144                                                                                                                </xsl:otherwise>
     1145                                                                                                        </xsl:choose>
     1146                                                                                                </button>
     1147                                                                                                <input type="checkbox" name="shared" value="true">
     1148                                                                                                        <xsl:if test="not($owned) or normalize-space(valid)=''">
    10231149                                                                                                                <xsl:attribute name="disabled" select="'disabled'"/>
    10241150                                                                                                        </xsl:if>
    1025                                                                                                         <xsl:text>check actions</xsl:text>
    1026                                                                                                 </button>
     1151                                                                                                        <xsl:if test="check/@shared='true'">
     1152                                                                                                                <xsl:attribute name="checked" select="'checked'"/>
     1153                                                                                                        </xsl:if>
     1154                                                                                                </input>
     1155                                                                                                <xsl:text>&#160;</xsl:text>
     1156                                                                                                <span>update shared DCs</span>
    10271157                                                                                        </td>
    10281158                                                                                </tr>
Note: See TracChangeset for help on using the changeset viewer.