
sec:create-user-with-role( $user-name as xs:string, $description as xs:string?, $password as xs:string, $role-names as xs:string*, $permissions as element(sec:permission)*, $collections as xs:string*, $external-names as xs:string* ) as xs:unsignedLong
Creates a new user in the system database for the context database. Returns the user ID of the created user. Also creates a role by the same name and assigns the newly-created user to the newly-created role. Parameters that define roles, permissions, and collections are only applied to the new user.
http://marklogic.com/xdmp/privileges/create-userhttp://marklogic.com/xdmp/privileges/create-rolehttp://marklogic.com/xdmp/privileges/grant-all-roles orhttp://marklogic.com/xdmp/privileges/grant-my-roles
This function must be executed against the security database.
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at
"/MarkLogic/security.xqy";
sec:create-user-with-role(
"Jim",
"Jim the temp",
"newtemp",
"Temporary",
(xdmp:permission("security", "read"),
xdmp:permission("security", "update")),
("http://marklogic.com/dev_modules"))
(: Creates a new user, named Jim, with the roles, Jim and Temporary.
Jim is assigned the default permissions, security(read) and security(update),
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.