Loading TOC...

sec:user-privileges

sec:user-privileges(
   $user-name as xs:string
) as element(sec:privilege)*

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 :)
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at 
     "/MarkLogic/security.xqy";

sec:user-privileges("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.