Loading TOC...


   $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.

$user-name A unique username. If $user-name is not unique, an error is returned.
$description A description of the user.
$password The initial password for this user.
$role-names The roles (if any) assigned to this user. If one of the $role-names names a role that does not exist, an error is returned.
$permissions The default permissions granted to this user.
$collections The URIs for the default collections to which this user has access.
$external-names One or more external names used to match the user with one or more Distinguished Names in an LDAP server or User Principals in a Kerberos server.

Required Privileges

and, for role assignment:
http://marklogic.com/xdmp/privileges/grant-all-roles or

Usage Notes

This function must be executed against the security database.


(: execute this against the security database :)
xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at 

    "Jim the temp",
    (xdmp:permission("security", "read")),
 (: 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 iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.