Loading TOC...

MarkLogic 12 EA 1 Product Documentation
sec.userSetQueries

sec.userSetQueries(
   user-name as String,
   queries as Object?
) as null

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.
declareUpdate(); 
const sec = require('/MarkLogic/security.xqy');
    
sec.userSetQueries(
  "Mike", 
  {
    "read": cts.wordQuery(["MarkLogic", "database"]),
    "node-update": cts.pathRangeQuery("//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.