Loading TOC...


   $uri as xs:string,
   $permissions as element(sec:permission)*
) as xs:unsignedLong


Protects a collection $uri with the given permissions ($permissions). Returns the unique id of the protected collection. If the protected collection at the specified URI does not exist, it is created.

uri The URI of a collection.
permissions Permissions governing the collection.

Required Privileges


Usage Notes

If $uri is empty or can not be cast as an xs:AnyURI, an error is raised.

If a collection with the same uri is already protected, an error is raised.

This function must be executed against the security database.


(: execute this against the security database :)
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at 

                       (xdmp:permission("Developer", "read"), 
                        xdmp:permission("Developer", "insert"))) 

(: Users with the "Developer" role can read and insert files in "dev_modules." :) 

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.