Loading TOC...


   [uri as String],
   [output-kind as String]
) as Object[]|Element[]


Returns the permissions any new document would get if the current user were to insert a document without specifying the default permissions.

uri The document URI to get default permissions.
output-kind The output kind. It can be either "objects" or "elements". With "objects", the built-in returns an array of objects. With "elements", the built-in returns an array of XML element nodes. The default is "objects".


// Retrieve the default permissions for a given URI, as objects:

// Returns an array of JSON objects, such as the following:
//  [{"permission" : {"capability" : "read", "roldId" : "324978243" }},
//   {"permission" : {"capability" : "read", "roldId" : "32493478578243" }},
//   {"permission" : {"capability" : "update", "roldId" : "32493478578243" }} ]


// Retrieve default permissions for the current user, as a 
// Sequence of XML elements
xdmp.defaultPermissions(null, 'elements');

// Returns an array of element nodes such as the following:
// [<sec:permission xmlns:sec="http://marklogic.com/xdmp/security">
//    <sec:capability>update</sec:capability>
//    <sec:role-id>8487823278258687528</sec:role-id>
//  </sec:permission>,
//  <sec:permission xmlns:sec="http://marklogic.com/xdmp/security">
//    <sec:capability>update</sec:capability>
//    <sec:role-id>8487823278258687528</sec:role-id>
//  </sec:permission>]

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