
sec.roleSetQueries( role-name as String, queries as Object? ) as null
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. | 
http://marklogic.com/xdmp/privileges/role-set-queries
  This function must be executed against the security database. If a role with name $role-name is not found, an error is raised.
// 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.