|Returns the name of the currently logged in user.
|-valign="top"
| '''Examples'''
|
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|user:list||xs:string*}}<br/>
|-valign="top"
| '''Summary'''
|Returns the names of all registered users that are visible to the current user.
|-valign="top"
| '''Examples'''
|
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|user:list-details||element(user)*}}<br/>{{Func|user:list-details|$name as xs:string|element(user)*}}<br/>
|-valign="top"
| '''Summary'''
|Returns an element sequence, containing all registered users that are visible to the current user.<br/>In addition to the {{Command|SHOW USERS}} command, encoded password strings and database permissions will be output. A user {{Code|$name}} can be specified to filter the results in advance.
|-valign="top"
| '''Examples'''
|
</user>
</syntaxhighlight>
|-valign="top"
| '''Errors'''
|{{Error|unknown|#Errors}} The specified user name is unknown.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|user:exists|$name as xs:string|xs:boolean}}<br/>
|-valign="top"
| '''Summary'''
|Checks if a user with the specified {{Code|$name}} exists.
|-valign="top"
| '''Examples'''
|
* {{Code|user:exists('admin')}} will always yield true.
|-valign="top"
| '''Errors'''
|{{Error|name|#Errors}} The specified user name is invalid.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|user:check|$name as xs:string, $password as xs:string|empty-sequence()}}<br/>
|-valign="top"
| '''Summary'''
|Checks if the specified user and password is correct. Raises errors otherwise.
|-valign="top"
| '''Examples'''
|
* {{Code|user:check('admin', 'admin')}} will raise an error if the admin password was changed.
|-valign="top"
| '''Errors'''
|{{Error|name|#Errors}} The specified user name is invalid.<br/>{{Error|unknown|#Errors}} The specified user does not exist.<br/>{{Error|password|#Errors}} The specified password is wrong.<br/>
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|user:info||element(info)}}<br/>{{Func|user:info|$name as xs:string|element(info)}}
|-valign="top"
| '''Summary'''
|Returns an <code>info</code> element, which may contain application-specific data. If a user {{Code|$name}} is supplied, a user-specific element is returned. By default, the returned element has no contents. It can be modified via {{Function||user:update-info}}.
|-valign="top"
| '''Examples'''
|
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|user:create|$name as xs:string, $password as xs:string|empty-sequence()}}<br/>{{Func|user:create|$name as xs:string, $password as xs:string, $permissions as xs:string*|empty-sequence()}}<br/>{{Func|user:create|$name as xs:string, $password as xs:string, $permissions as xs:string*, $patterns as xs:string*|empty-sequence()}}<br/>{{Func|user:create|$name as xs:string, $password as xs:string, $permissions as xs:string*, $patterns as xs:string*, $info as element(info)|empty-sequence()}}
|-valign="top"
| '''Summary'''
|Creates a new user with the specified {{Code|$name}}, {{Code|$password}}, and {{Code|$permissions}}:
* The default global permission (''none'') can be overwritten with an empty pattern or by omitting the last argument.
* Existing users will be overwritten.
|-valign="top"
| '''Examples'''
|
* {{Code|user:create('John', '7e$j#!1', 'admin')}} creates a new user 'John' with admin permissions.
* {{Code|user:create('Jack', 'top!secret', 'read', 'index*')}} creates a new user 'Jack' with read permissions for databases starting with the letters 'index'.
|-valign="top"
| '''Errors'''
|{{Error|name|#Errors}} The specified user name is invalid.<br/>{{Error|permission|#Errors}} The specified permission is invalid.<br/>{{Error|admin|#Errors}} The "admin" user cannot be modified.<br/>{{Error|logged-in|#Errors}} The specified user is currently logged in.<br/>{{Error|update|#Errors}} The operation can only be performed once per user or database pattern.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|user:grant|$name as xs:string, $permissions as xs:string*|empty-sequence()}}<br/>{{Func|user:grant|$name as xs:string, $permissions as xs:string*, $patterns as xs:string*|empty-sequence()}}
|-valign="top"
| '''Summary'''
|Grants global or local {{Code|$permissions}} to a user with the specified {{Code|$name}}. Local permissions are granted with non-empty glob {{Code|$patterns}}.
|-valign="top"
| '''Examples'''
|
* {{Code|user:grant('John', 'create')}} grants create permissions to the user 'John'.
* {{Code|user:grant('John', ('read','write'), ('index*','unit*'))}} allows John to read all databases starting with the letters 'index', and to write to all databases starting with 'unit'.
|-valign="top"
| '''Errors'''
|{{Error|unknown|#Errors}} The specified user name is unknown.<br/>{{Error|name|#Errors}} The specified user name is invalid.<br/>{{Error|pattern|#Errors}} The specified database pattern is invalid.<br/>{{Error|permission|#Errors}} The specified permission is invalid.<br/>{{Error|admin|#Errors}} The "admin" user cannot be modified.<br/>{{Error|local|#Errors}} A local permission can only be 'none', 'read' or 'write'.<br/>{{Error|logged-in|#Errors}} The specified user is currently logged in.<br/>{{Error|update|#Errors}} The operation can only be performed once per user or database pattern.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|user:drop|$name as xs:string|empty-sequence()}}<br/>{{Func|user:drop|$name as xs:string, $patterns as xs:string*|empty-sequence()}}
|-valign="top"
| '''Summary'''
|Drops a user with the specified {{Code|$name}}. If non-empty glob {{Code|$patterns}} are specified, only the database patterns will be removed.
|-valign="top"
| '''Examples'''
|
* {{Code|user:drop('John')}} drops the user 'John'.
* {{Code|user:grant('John', 'unit*')}} removes the 'unit*' database pattern. If John accesses any of these database, his global permission will be checked again.
|-valign="top"
| '''Errors'''
|{{Error|unknown|#Errors}} The specified user name is unknown.<br/>{{Error|name|#Errors}} The specified user name is invalid.<br/>{{Error|pattern|#Errors}} The specified database pattern is invalid.<br/>{{Error|admin|#Errors}} The "admin" user cannot be modified.<br/>{{Error|logged-in|#Errors}} The specified user is currently logged in.<br/>{{Error|update|#Errors}} The operation can only be performed once per user or database pattern.<br/>{{Error|conflict|#Errors}} A user cannot be both altered and dropped.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|user:alter|$name as xs:string, $newname as xs:string|empty-sequence()}}
|-valign="top"
| '''Summary'''
|Renames a user with the specified {{Code|$name}} to {{Code|$newname}}.
|-valign="top"
| '''Examples'''
|
* {{Code|user:alter('John', 'Jack')}} renames the user 'John' to 'Jack'.
|-valign="top"
| '''Errors'''
|{{Error|unknown|#Errors}} The specified user name is unknown.<br/>{{Error|name|#Errors}} The specified user name is invalid.<br/>{{Error|admin|#Errors}} The "admin" user cannot be modified.<br/>{{Error|logged-in|#Errors}} The specified user is currently logged in.<br/>{{Error|update|#Errors}} The operation can only be performed once per user or database pattern.<br/>{{Error|conflict|#Errors}} A user cannot be both altered and dropped.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|user:password|$name as xs:string, $password as xs:string|empty-sequence()}}
|-valign="top"
| '''Summary'''
|Changes the {{Code|password}} of a user with the specified {{Code|$name}}.
|-valign="top"
| '''Examples'''
|
* {{Code|user:password('John', '')}} assigns user 'John' an empty password string.
|-valign="top"
| '''Errors'''
|{{Error|unknown|#Errors}} The specified user name is unknown.<br/>{{Error|name|#Errors}} The specified user name is invalid.<br/>{{Error|update|#Errors}} The operation can only be performed once per user or database pattern.
{| width='100%'
|-valign="top"
| width='120' | '''Signatures'''
|{{Func|user:update-info|$info as element(info)|empty-sequence()}}<br/>{{Func|user:update-info|$info as element(info), $name as xs:string|empty-sequence()}}
|-valign="top"
| '''Summary'''
|Assigns the specified {{Code|$info}} element to the user management or, if {{Code|$name}} is supplied, to a specific user. This function can be used to manage application-specific data (groups, enhanced user info, etc.).
|-valign="top"
| '''Examples'''
|
! width="110"|Code
|Description
|-valign="top"
|{{Code|admin}}
|The "admin" user cannot be modified.
|-valign="top"
|{{Code|conflict}}
|A user cannot be both altered and dropped.
|-valign="top"
|{{Code|equal}}
|Name of old and new user is equal.
|-valign="top"
|{{Code|local}}
|A local permission can only be 'none', 'read' or 'write'.
|-valign="top"
|{{Code|logged-in}}
|The specified user is currently logged in.
|-valign="top"
|{{Code|name}}
|The specified user name is invalid.
|-valign="top"
|{{Code|password}}
|The specified password is wrong.
|-valign="top"
|{{Code|pattern}}
|The specified database name is invalid.
|-valign="top"
|{{Code|permission}}
|The specified permission is invalid.
|-valign="top"
|{{Code|unknown}}
|The specified user does not exist.
|-valign="top"
|{{Code|update}}
|The operation can only be performed once per user or database pattern.