Loading TOC...

sec.userSetQuery

sec.userSetQuery(
   $user-name as String,
   $capability as String,
   $query as cts.query?
) as null

Summary

Sets the $capability query of a user with $user-name to $query.

Parameters
$user-name The name of a user.
$capability The name of the capability.
$query A query for the given capability of 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.userSetQuery(
  "Mike", 
  "read",
  cts.wordQuery(["MarkLogic", "database"])
)

// Set the user query of the capability "read" for the user "Mike".
  

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