Loading TOC...

MarkLogic 10 Product Documentation
sec.getPrivilege

sec.getPrivilege(
   action as String,
   kind as 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
// There is no JSON output for this function.

const sec = require('/MarkLogic/security.xqy');

sec.getPrivilege(
    "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.