Changeset 3503


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

Enpoint for public schemas.
Decoupled 'authorized roles' from isAuthorized.dpml.
'Forbidden' response generalized to a generic endpoint.

Location:
cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.interface.rest
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.interface.rest/module.xml

    r3495 r3503  
    238238                        </endpoint>
    239239                        <endpoint>
     240                           <meta>
     241                              <rest>
     242                                 <method>GET</method>
     243                                 <simple>schemas/public{slash:(/|)}</simple>
     244                                 <compress/>
     245                                 <Etag>MD5</Etag>
     246                                 <preTarget>findUser</preTarget>
     247                                 <produces>application/json</produces>
     248                              </rest>
     249                           </meta>
     250                           <grammar>
     251                              <active>
     252                                 <identifier>active:org.schemacat.schemas.public.json</identifier>
     253                                 <argument name="slash"/>
     254                              </active>
     255                           </grammar>
     256                           <request>
     257                              <identifier>active:JSONFromXML</identifier>
     258                              <argument name="operand">
     259                                 <request>
     260                                    <identifier>active:sloot.dpml</identifier>
     261                                    <argument name="operator">res:/interface/publicSchemas.dpml</argument>
     262                                 </request>
     263                              </argument>
     264                           </request>
     265                        </endpoint>
     266                        <endpoint>
     267                           <meta>
     268                              <rest>
     269                                 <method>GET</method>
     270                                 <simple>schemas/public{slash:(/|)}</simple>
     271                                 <compress/>
     272                                 <Etag>MD5</Etag>
     273                                 <preTarget>findUser</preTarget>
     274                                 <produces>application/xml</produces>
     275                              </rest>
     276                           </meta>
     277                           <grammar>
     278                              <active>
     279                                 <identifier>active:org.schemacat.schemas.public.xml</identifier>
     280                                 <argument name="slash"/>
     281                              </active>
     282                           </grammar>
     283                           <request>
     284                              <identifier>active:sloot.dpml</identifier>
     285                              <argument name="operator">res:/interface/publicSchemas.dpml</argument>
     286                           </request>
     287                        </endpoint>
     288                        <endpoint>
    240289                           <!-- this falls through to the urn.org.isocat.schemacat.site module -->
    241290                           <meta>
     
    298347                        </endpoint>
    299348                        <endpoint>
    300                            <!-- true if requester is admin or authorized (owner or reader) -->
     349                           <!-- true if requester (from scratchpad) is present in authorized IDs or has an authorized role-->
    301350                           <id>isAuthorized</id>
    302351                           <grammar>
     
    304353                                 <identifier>active:isAuthorized</identifier>
    305354                                 <argument name="authorizedIDs" min="1" max="1"/>
     355                                 <argument name="authorizedRoles" min="1" max="1"/>
    306356                              </active>
    307357                           </grammar>
     
    310360                              <argument name="operator">res:/interface/isAuthorized.dpml</argument>
    311361                              <argument name="authorizedIDs">arg:authorizedIDs</argument>
     362                              <argument name="authorizedRoles">arg:authorizedRoles</argument>
     363                           </request>
     364                        </endpoint>
     365                        <endpoint>
     366                           <grammar>
     367                              <active>
     368                                 <identifier>active:interface.rest.HTTPresponse.forbidden</identifier>
     369                              </active>
     370                           </grammar>
     371                           <request>
     372                              <identifier>active:groovy</identifier>
     373                              <argument name="operator">
     374                                 <!-- TODO: check if this is the proper way to generata a forbidden response -->
     375                                 <literal type="string">
     376                                    context.createResponseFrom("&lt;html lang='en' xmlns='http://www.w3.org/1999/xhtml'&gt;&lt;body&gt;&lt;img src='/schemacat/site/images/HTTPstatus/403-Forbidden.jpg'/&gt;&lt;/body&gt;&lt;/html&gt;").setMimeType("text/html");
     377                                    context.sink("httpResponse:/code", 403);
     378                                 </literal>
     379                              </argument>
    312380                           </request>
    313381                        </endpoint>
Note: See TracChangeset for help on using the changeset viewer.