Loading TOC...

sec:role-privileges

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

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