Index: cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.interface.rest/interface/licenses.dpml
===================================================================
--- cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.interface.rest/interface/licenses.dpml	(revision 4571)
+++ cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.interface.rest/interface/licenses.dpml	(revision 4571)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sequence debug="false">
+	<log>
+		<level>INFO</level>
+		<message>
+			<literal type="string">[interface.REST] [%1] requested licenses list.</literal>
+		</message>
+		<param>
+			<request>
+				<identifier>active:xpath2</identifier>
+				<argument name="operand">scratch:user</argument>
+				<argument name="operator">
+					<literal type="string">string(/sc:user/@xml:id)</literal>
+				</argument>
+			</request>
+		</param>
+	</log>
+	<request assignment="response">
+		<identifier>active:org.isocat.schemacat.access.data.licenses</identifier>
+		<verb>SOURCE</verb>
+	</request>
+	<sloot-debug>
+		<request>
+			<verb>SINK</verb>
+			<identifier>res:/debug/org.isocat.schemacat.interface.rest.licenses.response.xml</identifier>
+			<argument name="primary">this:response</argument>
+		</request>
+	</sloot-debug>
+</sequence>
Index: cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.interface.rest/interface/postSchemaAccess.dpml
===================================================================
--- cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.interface.rest/interface/postSchemaAccess.dpml	(revision 4570)
+++ cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.interface.rest/interface/postSchemaAccess.dpml	(revision 4571)
@@ -1,4 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<sequence debug="false">
+<!-- 
+POST body format:
+<json>
+    <access>
+        <user>
+            <ref>u1</ref>
+            <role>owner</role>
+            <actions>rud</actions>
+        </user>
+    </access>
+</json>
+-->
+<sequence debug="true">
     <log>
         <level>INFO</level>
@@ -128,4 +140,13 @@
                             <argument name="postedAuthorizedUsers">this:postedAuthorizedUsers</argument>
                         </request>
+                        <sloot-debug>
+                            <log>
+                                <level>INFO</level>
+                                <message>
+                                    <literal type="string">[interface.REST] New authorized users SINKed to data module:&#xA;[&#xA;%1&#xA;]</literal>
+                                </message>
+                                <param>this:authorizedUsers</param>
+                            </log> 
+                        </sloot-debug>
                         <request assignment="response">
                             <identifier>active:org.isocat.schemacat.access.data.schema.authorizedIDs</identifier>
Index: cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.interface.rest/interface/postSchemaMetadataField.dpml
===================================================================
--- cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.interface.rest/interface/postSchemaMetadataField.dpml	(revision 4571)
+++ cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.interface.rest/interface/postSchemaMetadataField.dpml	(revision 4571)
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 
+POST body format:
+<json>
+    <[field]>
+        [fieldValue]
+    </[field]>
+</json>
+-->
+<sequence debug="false">
+    <log>
+        <level>INFO</level>
+        <message>
+            <literal type="string">[interface.REST] [%1] posted new [%2] for schema with id: [%3]</literal>
+        </message>
+        <param>
+            <request>
+                <identifier>active:xpath2</identifier>
+                <argument name="operand">scratch:user</argument>
+                <argument name="operator">
+                    <literal type="string">string(/sc:user/@xml:id)</literal>
+                </argument>
+            </request>
+        </param>
+        <param>arg:metadataFieldName</param>
+        <param>arg:schemaID</param>
+    </log>
+    <!-- Fetch authorized IDs from the database -->
+    <request assignment="authorized-IDs">
+        <identifier>active:org.isocat.schemacat.access.data.schema.authorizedIDs</identifier>
+        <argument name="schemaID">arg:schemaID</argument>
+    </request>
+    <!-- Obtain IDs authorized to update the schema -->    
+    <request assignment="authorized-update-IDs">
+        <identifier>active:sloot.xquery</identifier>
+        <argument name="operator">
+            <literal type="xml">
+                <query>
+                    <ids>
+                        {
+                        for $id in $authorizedIDs/ids/id
+                        return  if (contains($id/@actions, 'u')) 
+                        then $id 
+                        else ()
+                        }
+                    </ids>
+                </query>
+            </literal>
+        </argument>
+        <argument name="authorizedIDs">this:authorized-IDs</argument>
+    </request>
+    <sloot-debug>
+        <log>
+            <level>INFO</level>
+            <message>
+                <literal type="string">[interface.REST] Users authorized to update schema metadata:&#xA;[&#xA;%1&#xA;]</literal>
+            </message>
+            <param>this:authorized-update-IDs</param>
+        </log> 
+    </sloot-debug>
+    <if assignment="response">
+        <cond>
+            <request>
+                <identifier>active:isAuthorized</identifier>
+                <argument name="authorizedIDs" method="identity">this:authorized-update-IDs</argument>
+                <argument name="authorizedRoles" method="identity">
+                    <request>
+                        <identifier>active:org.isocat.schemacat.access.data.schemas.authorizedRoles</identifier>
+                    </request>
+                </argument>
+                <argument name="user" method="identity">scratch:user</argument>
+            </request>
+        </cond>
+        <then>
+            <if>
+                <cond>
+                    <request>
+                        <identifier>httpRequest:/body</identifier>
+                        <verb>EXISTS</verb>
+                    </request>
+                </cond>
+                <then>
+                    <sequence>
+                        <request assignment="body-XML">
+                            <identifier>active:JSONToXML</identifier>
+                            <argument name="operand">httpRequest:/body</argument>
+                            <argument name="operator">
+                                <literal type="xml">
+                                    <config>
+                                        <addRootElement>true</addRootElement>
+                                    </config>
+                                </literal>
+                            </argument>
+                        </request>
+                        <sloot-debug>
+                            <log>
+                                <level>INFO</level>
+                                <message>
+                                    <literal type="string">[interface.REST] POST body for schema [%1] update request:&#xA;[&#xA;%2&#xA;]</literal>
+                                </message>
+                                <param>arg:metadataFieldName</param>
+                                <param>this:body-XML</param>
+                            </log> 
+                        </sloot-debug>
+                        <request assignment="schemaMetadataUpdateFragment">
+                            <identifier>active:xslt2</identifier>
+                            <argument name="operand">this:body-XML</argument>
+                            <argument name="operator">
+                                <literal type="xml">
+                                    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sc="http://www.isocat.org/ns/schemacat" version="2.0">
+                                        <!-- transform the XQuery XML into a valid BaseX REST Query document -->
+                                        <xsl:import href="active:sloot.xquery-wrapers.escape"/>
+                                        <xsl:template match="/json">
+                                            <sc:schema>
+                                                <xsl:choose>
+                                                    <xsl:when  test="./*[1]/name() eq 'license'">
+                                                        <sc:license>
+                                                            <xsl:attribute name="ref"><xsl:value-of select="./*[1]/text()"/></xsl:attribute>
+                                                        </sc:license>
+                                                    </xsl:when>
+                                                    <xsl:otherwise>
+                                                        <xsl:apply-templates/>
+                                                    </xsl:otherwise>
+                                                </xsl:choose>
+                                            </sc:schema>
+                                        </xsl:template>
+                                        <xsl:template match="element()">
+                                            <xsl:element name="{concat('sc:', local-name())}">
+                                                <xsl:apply-templates/>
+                                            </xsl:element>
+                                        </xsl:template>
+                                    </xsl:stylesheet>
+                                </literal>
+                            </argument>
+                        </request> 
+                        <sloot-debug>
+                            <log>
+                                <level>INFO</level>
+                                <message>
+                                    <literal type="string">[interface.REST] New [%1] update fragment extracted from POST body:&#xA;[&#xA;%2&#xA;]</literal>
+                                </message>
+                                <param>arg:metadataFieldName</param>
+                                <param>this:schemaMetadataUpdateFragment</param>
+                            </log> 
+                        </sloot-debug>
+                        <request assignment="response">
+                            <identifier>active:org.isocat.schemacat.access.data.schema.metadata</identifier>
+                            <verb>SINK</verb>
+                            <argument name="id">arg:schemaID</argument>
+                            <argument name="schemaMetadataFragment">this:schemaMetadataUpdateFragment</argument>
+                        </request>
+                    </sequence>
+                </then>
+                <else>
+                    <throw>
+                        <id>
+                            <literal type="string">NK_INPUT_ARGS_NOT_COMPLETE</literal>
+                        </id>
+                        <message>
+                            <literal type="string">org.isocat.schemacat.interface.rest.post.schema.access: POST body not supplied!</literal>
+                        </message>
+                    </throw>
+                </else>
+            </if>
+        </then>
+        <else>
+            <request>
+                <identifier>active:interface.rest.HTTPresponse.forbidden</identifier>
+            </request>
+        </else>
+    </if>
+    <sloot-debug>
+        <request>
+            <verb>SINK</verb>
+            <identifier>res:/debug/org.isocat.schemacat.interface.rest.post.schema.access.response.xml</identifier>
+            <argument name="primary">this:response</argument>
+        </request>
+    </sloot-debug>
+</sequence>
Index: cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.interface.rest/module.xml
===================================================================
--- cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.interface.rest/module.xml	(revision 4570)
+++ cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.interface.rest/module.xml	(revision 4571)
@@ -170,4 +170,36 @@
                      <meta>
                         <rest>
+                           <method>POST</method>
+                           <simple>/schemas/{schemaID:([^/]+)}/{metadataFieldName:(?!access)[^/]+}{slash:(/|)}</simple>
+                           <compress/>
+                           <Etag>MD5</Etag>
+                           <consumes>application/json</consumes>
+                           <produces>application/json</produces>
+                        </rest>
+                     </meta>
+                     <grammar>
+                        <active>
+                           <identifier>active:org.schemacat.rest.schema.metadataField</identifier>
+                           <argument name="schemaID"/>
+                           <argument name="metadataFieldName"/>
+                           <argument name="slash"/>
+                        </active>
+                     </grammar>
+                     <request>
+                        <identifier>active:JSONFromXML</identifier>
+                        <argument name="operand">
+                           <request>
+                              <identifier>active:sloot.dpml</identifier>
+                              <argument name="operator">res:/interface/postSchemaMetadataField.dpml</argument>
+                              <argument method="as-string" name="schemaID">arg:schemaID</argument>
+                              <argument method="as-string" name="metadataFieldName">arg:metadataFieldName</argument>
+                           </request>
+                        </argument>
+                     </request>
+                     <header name="mime">application/json</header>
+                  </endpoint>
+                  <endpoint>
+                     <meta>
+                        <rest>
                            <method>GET</method>
                            <simple>/users/{userID:([^/]+)}{slash:(/|)}</simple>
@@ -722,4 +754,55 @@
                         </argument>
                      </request>
+                  </endpoint>
+                  <endpoint>
+                     <meta>
+                        <rest>
+                           <method>GET</method>
+                           <simple>/licenses{slash:(/|)}</simple>
+                           <compress/>
+                           <Etag>MD5</Etag>
+                           <produces>application/json</produces>
+                        </rest>
+                     </meta>
+                     <grammar>
+                        <active>
+                           <identifier>active:org.schemacat.rest.user.licenses.xml</identifier>
+                           <argument name="slash"/>
+                        </active>
+                     </grammar>
+                     <request>
+                        <identifier>active:JSONFromXML</identifier>
+                        <argument name="operand">
+                           <request>
+                              <identifier>active:sloot.dpml</identifier>
+                              <argument name="operator">res:/interface/licenses.dpml</argument>
+                           </request>
+                        </argument>
+                     </request>
+                     <header name="httpResponse:/header/Cache-Control">max-age=0, must-revalidate</header>
+                     <header name="HTTP_CACHE_EXPIRES_DELTA_SECONDS">0</header>
+                  </endpoint>
+                  <endpoint>
+                     <meta>
+                        <rest>
+                           <method>GET</method>
+                           <simple>/licenses{slash:(/|)}</simple>
+                           <compress/>
+                           <Etag>MD5</Etag>
+                           <produces>application/xml</produces>
+                        </rest>
+                     </meta>
+                     <grammar>
+                        <active>
+                           <identifier>active:org.schemacat.rest.user.licenses.xml</identifier>
+                           <argument name="slash"/>
+                        </active>
+                     </grammar>
+                     <request>
+                        <identifier>active:sloot.dpml</identifier>
+                        <argument name="operator">res:/interface/licenses.dpml</argument>
+                     </request>
+                     <header name="httpResponse:/header/Cache-Control">max-age=0, must-revalidate</header>
+                     <header name="HTTP_CACHE_EXPIRES_DELTA_SECONDS">0</header>
                   </endpoint>
                   <endpoint>
