Loading TOC...

sec.rolePrivileges

sec.rolePrivileges(
   role-name as String
) as Sequence

Summary

Returns a set of privilege elements corresponding to all privileges that a role has. (Roles are flattened to give a complete set of privileges).

Parameters
role-name The name of a role.

Required Privileges

http://marklogic.com/xdmp/privileges/role-privileges if the current role is not $role-name.

Usage Notes

If a role with name equal to $role-name 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.rolePrivileges("Developer")
  
=>

<sec:privilege xmlns:sec="http://marklogic.com/xdmp/security">
 <sec:privilege-id>12387631775818383068</sec:privilege-id>
  <sec:privilege-name>xdmp:save</sec:privilege-name>
  <sec:action>http://marklogic.com/xdmp/privileges/xdmp-save</sec:action>
  <sec:role-ids>
    <sec:role-id>13749738523688002780</sec:role-id>
  </sec:role-ids>
  <sec:kind>execute</sec:kind>
</sec:privilege>
//  ..... and all other privileges assigned to "Developer."  

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