Loading TOC...

sec.getCollection

sec.getCollection(
   $uri as String
) as element(sec.collection)

Summary

Gets the security document corresponding to a protected collection with uri equal to $uri.

Parameters
$uri The URI of a collection.

Required Privileges

http://marklogic.com/xdmp/privileges/unprotect-collection or
http://marklogic.com/xdmp/privileges/collection-set-permissions or
http://marklogic.com/xdmp/privileges/collection-add-permissions or
http://marklogic.com/xdmp/privileges/collection-remove-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
// There is no JSON output for this function.
 
const sec = require('/MarkLogic/security.xqy');
 
sec.getCollection("http://marklogic.com/cpf/domains")

=>
  
<sec:collection xmlns:sec="http://marklogic.com/xdmp/security">
  <sec:collection-id>403495114666638078</sec:collection-id>
  <sec:uri>http://marklogic.com/cpf/domains</sec:uri>
</sec:collection>
  

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