Loading TOC...

MarkLogic 12 EA 1 Product Documentation
sec.roleSetQueries

sec.roleSetQueries(
   role-name as String,
   queries as Object?
) as null

Summary

Sets the queries of a role with name $role-name to $queries.

Parameters
role-name The name of a role.
queries A map from capabilities to cts queries for the role.

Required Privileges

http://marklogic.com/xdmp/privileges/role-set-queries

Usage Notes

This function must be executed against the security database. If a role with name $role-name is not found, an error is raised.

Example


// execute this against the security database.
declareUpdate(); 
const sec = require('/MarkLogic/security.xqy');
    
sec.roleSetQueries(
  "region-NA", 
  {
    "read": cts.elementQuery(xs.QName("metadata"), 
      cts.elementWordQuery(xs.QName("region"),"EMEA")),
    "node-update": cts.elementQuery(xs.QName("price"), cts.trueQuery())
  }
)

// Set role queries for a role named "region-NA". The role queries allow any 
// users with "region-NA" role to read documents with "region-NA" in the 
// metadata, and to update documents with price element.
  

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