Changeset 4369


Ignore:
Timestamp:
01/28/14 17:21:50 (10 years ago)
Author:
andmor
Message:

Modified resource to extract from the schema metadata, the authorized user IDs to access it, so the response is equal to the response obained when sourcing the authorized user IDs from the database through the 'data.access' module.

File:
1 edited

Legend:

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

    r3879 r4369  
    4141        <argument name="operator">
    4242            <literal type="xml">
    43                 <ids xmlns:sc="http://www.isocat.org/ns/schemacat">{
    44                     for $userID in $schemaMetadata//sc:schema/sc:access/sc:user/@ref
    45                         return <id>{string($userID)}</id> }
    46                 </ids>
     43                <!--Code for active:xquery-->
     44                <!--declare namespace sc = "http://www.isocat.org/ns/schemacat";
     45                declare variable $schemaMetadata external;
     46               
     47                element ids {
     48                for $user in $schemaMetadata/sc:schema/sc:access/*
     49                    return  if (name($user) eq 'sc:all' and contains($user/@actions,'r'))
     50                            then element id {
     51                                attribute actions{$user/@actions},
     52                                'ALL'
     53                            }
     54                            else ( element id {
     55                                        attribute actions{$user/@actions},
     56                                        attribute role{$user/@role},
     57                                        string($user/@ref)
     58                                    }
     59                            )
     60                }-->
     61                    <ids xmlns:sc="http://www.isocat.org/ns/schemacat">{
     62                        for $user in $schemaMetadata/sc:schema/sc:access/*
     63                            return if (name($user) eq 'sc:all' and contains($user/@actions ,'r'))
     64                                        then <id actions="{data($user/@actions)}">ALL</id>
     65                                        else <id actions="{data($user/@actions)}"
     66                                                 role="{data($user/@role)}">{string($user/@ref)}</id>
     67                        }
     68                    </ids>
    4769            </literal>
    4870        </argument>
Note: See TracChangeset for help on using the changeset viewer.