MarkLogic 10 Product Documentation
sec:user-set-queries

sec:user-set-queries(
   $user-name as xs:string,
   $queries as map:map?
) as empty-sequence()

Summary

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.

Required Privileges

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

Usage Notes

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

Example


(: 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. :)
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy