Loading TOC...

sec.collectionSetPermissions

sec.collectionSetPermissions(
   uri as String,
   permissions as element(sec.permission)[]
) as null

Summary

Sets the permissions of a protected collection identified by $uri to $permissions.

Parameters
uri The URI of a collection.
permissions New permissions. If the empty sequence is provided, deletes the existing permissions.

Required Privileges

http://marklogic.com/xdmp/privileges/collection-set-permissions

Usage Notes

If a protected collection with uri equal to $uri is not found, an error is raised.

This function must be executed against the security database.

Example


// execute this against the security database

declareUpdate(); 
const sec = require('/MarkLogic/security.xqy');

sec.collectionSetPermissions("http://marklogic.com/dev_modules",
                               [xdmp.permission("Temporary", "read","element"), 
                                xdmp.permission("Temporary", "insert","element")])

// Sets the permissions on "dev_modules" to Developer(read) and Developer(update).
   Any previous permissions on the collection are removed. 

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