Changeset 3502


Ignore:
Timestamp:
09/03/13 08:41:21 (11 years ago)
Author:
andmor
Message:

Decoupled 'authorized roles' from code.
Some more compreensive debug info.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.interface.rest/interface/isAuthorized.dpml

    r3485 r3502  
    11<?xml version="1.0" encoding="UTF-8"?>
    22<sequence debug="true">
     3    <sloot-debug>
     4        <request>
     5            <verb>SINK</verb>
     6            <identifier>res:/debug/org.isocat.schemacat.interface.isAuthorized.authorizedIDs.xml</identifier>
     7            <argument name="primary">arg:authorizedIDs</argument>
     8        </request>
     9        <request>
     10            <verb>SINK</verb>
     11            <identifier>res:/debug/org.isocat.schemacat.interface.isAuthorized.authorizedRoles.xml</identifier>
     12            <argument name="primary">arg:authorizedRoles</argument>
     13        </request>
     14    </sloot-debug>
    315    <!-- TODO: check if enclosing request to sloot.xpath can be removed -->
    416    <request assignment="response">
     
    1224                        <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sc="http://www.isocat.org/ns/schemacat" version="2.0">
    1325                            <xsl:param name="authorizedIDs"/>
     26                            <xsl:param name="authorizedRoles"/>
    1427                            <xsl:param name="debug"/>
    1528                            <xsl:template match="/">
    16                                 <b><xsl:value-of select="string(/sc:user/sc:role = 'admin' or /sc:user/@xml:id = $authorizedIDs/id)"/></b>
     29                                <b><xsl:value-of select="string(/sc:user/sc:role = $authorizedRoles/roles/role or /sc:user/@xml:id = $authorizedIDs/ids/id)"/></b>
    1730                            </xsl:template>
    1831                        </xsl:stylesheet>
     
    2033                </argument>
    2134                <argument name="authorizedIDs">arg:authorizedIDs</argument>
     35                <argument name="authorizedRoles">arg:authorizedRoles</argument>
    2236                <argument name="debug">this:sloot-debug</argument>
    2337            </request>
     
    3145            <level>INFO</level>
    3246            <message>
    33                 <literal type="string">[interface.REST] User id [%1] authorized to access resource from id [%2]: [%3]</literal>
     47                <literal type="string">[interface.REST] [%1] authorized to access resource.&#xA;Authorized IDs:&#xA;[&#xA;%2]&#xA;Authorized roles:&#xA;[&#xA;%3]&#xA;=> [%4]</literal>
    3448            </message>
    3549            <param>
     
    4458            </param>
    4559            <param>arg:authorizedIDs</param>
     60            <param>
     61                <!-- pass the response trough sloot.xpath2 so the actual
     62                                user document is logged instead of the value of its pointer!-->
     63                <request>
     64                    <identifier>active:sloot.xpath2</identifier>
     65                    <argument name="operand">arg:authorizedRoles</argument>
     66                    <argument name="operator">
     67                        <literal type="xml">
     68                            <dummy>.</dummy>
     69                        </literal>
     70                    </argument>
     71                </request>
     72            </param>
    4673            <param>this:response</param>
    4774        </log>
Note: See TracChangeset for help on using the changeset viewer.