Important note: All functions in this section are updating functions: they will not be immediately executed, but queued on the Pending Update List, which will be processed after the actual query has been evaluated. This means that the order in which the functions are specified in the query does usually not reflect the order in which the code will be evaluated.
user:create
Template:Mark: Support for multiple database patterns.
Signatures
|
user:create($name as xs:string, $password as xs:string) as empty-sequence()
user:create($name as xs:string, $password as xs:string, $permissions as xs:string*) as empty-sequence()
user:create($name as xs:string, $password as xs:string, $permissions as xs:string*, $patterns as xs:string*) as empty-sequence()
|
Summary
|
Creates a new user with the specified $name and $password . The default permission none can be overwritten with the $permission argument. Existing users will be overwritten.
|
Examples
|
user:create('John', '7e$j#!1', 'admin') creates a new user 'John' with admin permissions.
user:create('Jack', 'top!secret', 'read', 'index*') creates a new user 'Jack' with no permissions, but write permissions for databases starting with the letters 'index'.
|
Errors
|
name : The specified user name is invalid.
permission : The specified permission is invalid.
admin : The "admin" user cannot be modified.
logged-in : The specified user is currently logged in.
update : The operation can only be performed once per user or database pattern.
|
user:grant
Template:Mark: Support for multiple database patterns.
Signatures
|
user:grant($name as xs:string, $permissions as xs:string*) as empty-sequence()
user:grant($name as xs:string, $permissions as xs:string*, $patterns as xs:string*) as empty-sequence()
|
Summary
|
Grants global or local $permissions to a user with the specified $name . Local permissions are granted with non-empty glob $patterns .
|
Examples
|
user:grant('John', 'create') grants create permissions to the user 'John'.
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'.
|
Errors
|
unknown : The specified user name is unknown.
name : The specified user name is invalid.
pattern : The specified database pattern is invalid.
permission : The specified permission is invalid.
admin : The "admin" user cannot be modified.
local : A local permission can only be 'none', 'read' or 'write'.
logged-in : The specified user is currently logged in.
update : The operation can only be performed once per user or database pattern.
|
user:drop
Template:Mark: Support for multiple database patterns.
Signatures
|
user:drop($name as xs:string) as empty-sequence()
user:drop($name as xs:string, $patterns as xs:string*) as empty-sequence()
|
Summary
|
Drops a user with the specified $name . If non-empty glob $patterns are specified, only the database patterns will be dropped.
|
Examples
|
user:drop('John') drops the user 'John'.
user:grant('John', 'unit*') removes the 'unit*' database pattern. If John accesses any of these database, his global permission will be checked again.
|
Errors
|
unknown : The specified user name is unknown.
name : The specified user name is invalid.
pattern : The specified database pattern is invalid.
admin : The "admin" user cannot be modified.
logged-in : The specified user is currently logged in.
update : The operation can only be performed once per user or database pattern.
conflict : A user cannot be both altered and dropped.
|
user:alter
Signatures
|
user:alter($name as xs:string, $newname as xs:string) as empty-sequence()
|
Summary
|
Renames a user with the specified $name to $newname .
|
Examples
|
user:rename('John', 'Jack') renames the user 'John' to 'Jack'.
|
Errors
|
unknown : The specified user name is unknown.
name : The specified user name is invalid.
admin : The "admin" user cannot be modified.
logged-in : The specified user is currently logged in.
update : The operation can only be performed once per user or database pattern.
conflict : A user cannot be both altered and dropped.
|
user:password
Signatures
|
user:password($name as xs:string, $password as xs:string) as empty-sequence()
|
Summary
|
Changes the password of a user with the specified $name .
|
Examples
|
user:password('John', ) assigns user 'John' an empty password string.
|
Errors
|
unknown : The specified user name is unknown.
name : The specified user name is invalid.
update : The operation can only be performed once per user or database pattern.
|