sec:role-set-queries( $role-name as xs:string, $queries as map:map? ) as empty-sequence()
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 :) xquery version "1.0-ml"; import module namespace sec = "http://marklogic.com/xdmp/security" at "/MarkLogic/security.xqy"; sec:role-set-queries( "region-NA", map:map()=>map:with( "read", cts:element-query(xs:QName("metadata"), cts:element-word-query(xs:QName("region"),"NA")) )=>map:with( "node-update", cts:element-query(xs:QName("price"), cts:true-query()) ) ) (: 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. :)