MarkLogic Server 11.0 Product Documentation
sec:protect-collection

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

Summary

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.

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

Required Privileges

http://marklogic.com/xdmp/privileges/protect-collection

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.

Example


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

sec:protect-collection("http://marklogic.com/dev_modules", 
                       (xdmp:permission("Developer", "read"), 
                        xdmp:permission("Developer", "insert"))) 

(: Users with the "Developer" role can read and insert files in "dev_modules." :) 
Powered by MarkLogic Server | Terms of Use | Privacy Policy