sec:user-set-queries( $user-name as xs:string, $queries as map:map? ) as empty-sequence()
Sets the queries of a user with name $user-name to $queries.
Parameters | |
---|---|
user-name | The name of a user. |
queries | A map from capabilities to cts queries for the user. |
http://marklogic.com/xdmp/privileges/user-set-queries
This function must be executed against the security database. If a user with name $user-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:user-set-queries( "Mike", map:map()=>map:with( "read", cts:word-query(("MarkLogic", "database")) )=>map:with( "node-update", cts:path-range-query("//pubinfo/pubyear", "=", 2021) ) ) (: Set user queries for a user named "Mike". The user queries allow Mike to read only documents that match "MarkLogic" or "database", and to update documents whose pub year is 2021. :)
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.