
sec.createUser( user-name as String, description as String?, password as String, role-names as String[], permissions as element(sec.permission)[], collections as String[], [external-names as String[]] ) as (Number|String)
Creates a new user in the system database for the context database. Returns the user ID of the created user.
http://marklogic.com/xdmp/privileges/create-userhttp://marklogic.com/xdmp/privileges/grant-all-roles orhttp://marklogic.com/xdmp/privileges/grant-my-roles
This function must be executed against the security database.
// execute this against the security database
declareUpdate();
const sec = require('/MarkLogic/security.xqy');
sec.createUser(
"Jim",
"Jim the temp",
"newtemp",
"Temporary",
[xdmp.permission("security", "read","element")]
["http://marklogic.com/dev_modules"])
// Creates a new user, named "Jim," with the role, "Temporary." "Jim"
is assigned the default permission, security(read), and the default
collection, "http://marklogic.com/dev_modules".
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.