
sec:role-set-query( $role-name as xs:string, $capability as xs:string, $query as cts:query? ) as empty-sequence()
Sets the $capability query of a role with $role-name to $query.
| Parameters | |
|---|---|
| role-name | The name of a role. | 
| capability | The name of the capability. | 
| query | A query for the given capability of 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 :)
xquery version "1.0-ml"; 
import module namespace sec = "http://marklogic.com/xdmp/security" 
  at "/MarkLogic/security.xqy"; 
  
sec:role-set-query(
  "region-NA", 
  "read", 
  cts:element-query(xs:QName("metadata"), cts:element-word-query(xs:QName("region"),"NA"))
)
(: Set the role query of the capability "read" for the role "region-NA":)
  
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.