Loading TOC...

MarkLogic 12 EA 2 Product Documentation
xdmp.parsePermission

xdmp.parsePermission(
   perm as String,
   [output-kind as String]
) as Object|Element

Summary

Returns a permission object corresponding to the element or object given. This function is in particular useful for converting XQuery-style permissions (element) in JSON-style (object) permissions.

Parameters
perm A permission element or object (output of xdmp:permission())
output-kind The output format. Allowed values: "element" or "object". The default format is "object" (JSON object). When you set this parameter to "element", this function returns an XML element node, suitable for inclusion in contexts that require permissions expressed as XML.

Example

'use strict';
const permissionAsElement=xdmp.permission("admin","read","element");
xdmp.parsePermission(permissionAsElement,"object")
  =>
  {
    "capability" : "read",
    "roleId" : "32497824353"
  }

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