Loading TOC...
Matches for cat:function (cat:function/xquery (cat:function/xquery (cat:function (cat:function/xquery (cts:words))))) have been highlighted. remove

MarkLogic Server 11.0 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. :)
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.