Loading TOC...

MarkLogic Server 11.0 Product Documentation
sec:get-privilege

sec:get-privilege(
   $action as xs:string,
   $kind as xs:string
) as element(sec:privilege)?

Summary

Returns a sec:privilege element corresponding to a privilege identified by ($action,$kind). If no such privilege is found, an error is returned.

Parameters
action Action protected by this privilege. For an Execute Privilege, this is usually a URI describing an activity. For a URI Privilege, this is a base URI used to filter database activities with certain document URIs.
kind Either "execute" or "uri".

Usage Notes

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:get-privilege(
    "http://marklogic.com/xdmp/privileges/admin-module-read",
    "execute")

=>

<sec:privilege xmlns:sec="http://marklogic.com/xdmp/security">
  <sec:privilege-id>17293336516617295309</sec:privilege-id>
  <sec:privilege-name>admin-module-read</sec:privilege-name>
  <sec:action>http://marklogic.com/xdmp/privileges/admin-module-read</sec:action>
  <sec:role-ids>
    <sec:role-id>5444982746628127945</sec:role-id>
    <sec:role-id>6629014463670416824</sec:role-id>
  </sec:role-ids>
  <sec:kind>execute</sec:kind>
</sec:privilege>
   

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