sec.userSetQueries( user-name as String, queries as Object? ) as null
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. 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: Get the most useful answers to questions from the MarkLogic community, or ask your own question.