Loading TOC...

sec.getDistinctPermissions

sec.getDistinctPermissions(
   $input-perms as element(sec.permission)[],
   $output-perms as element(sec.permission)[]
) as Sequence

Summary

Returns a sequence of permission elements made up of a concatenation of $output-perms and the distinct permission elements of $input-perms.

Parameters
$input-perms The input permissions.
$output-perms The output permissions. This is typically an empty sequence.

Usage Notes

This function must be executed against the security database.

Example


// execute this against the security database

declareUpdate();
const sec = require('/MarkLogic/security.xqy');
 
sec.getDistinctPermissions(
    [xdmp.permission("security", "read","element"),
     xdmp.permission("security", "update","element")],
     [])

=>

<sec.permission xmlns:sec="http://marklogic.com/xdmp/security">
  <sec.capability>update</sec.capability>
  <sec.role-id>16363340809666818373</sec.role-id>
</sec.permission>
<sec.permission xmlns:sec="http://marklogic.com/xdmp/security">
  <sec.capability>read</sec.capability>
  <sec.role-id>16363340809666818373</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.