Loading TOC...

MarkLogic 10 Product Documentation
sec.userPrivileges

sec.userPrivileges(
   user-name as String
) as Sequence

Summary

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

Parameters
user-name The name of a user.

Required Privileges

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

Usage Notes

If a user with name equal to $user-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.userPrivileges("Jim")

=>

<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 "jim." 
  

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