Changes

Jump to navigation Jump to search
4,387 bytes added ,  00:44, 11 December 2014
no edit summary
=Conventions=
All functions in this module and errors are assigned to the {{Code|http://basex.org/modules/user}} namespace, which is statically bound to the {{Code|user}} prefix.<br/>All errors are assigned to the {{Code|http://basex.org/errors}} namespace, which is statically bound to the {{Code|bxerr}} prefix.
=Functions=
|-
| '''Errors'''
|{{Error|BXUS0001name|#Errors}} The specified user name is invalid.|} ==user:create== {| width='100%'|-| 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, $permission as xs:string|empty-sequence()}}|-| '''Summary'''|Creates a new user with the specified {{Code|$name}} and {{Code|$password}}. The default permission {{Code|none}} can be overwritten with the {{Code|$permission}} argument. Existing users will be overwritten.|-| '''Examples'''|* {{Code|user:create('John', '7e$j#!1', 'admin')}} creates a new user 'John' with admin permissions.|-| '''Errors'''|{{Error|name|#Errors}} The specified user name is invalid.|{{Error|permission|#Errors}} The specified permission is invalid.|{{Error|admin|#Errors}} The "admin" user cannot be modified.|{{Error|logged-in|#Errors}} The specified user is currently logged in.|{{Error|update|#Errors}} The operation can only be performed once per user or database pattern.|} ==user:grant== {| width='100%'|-| width='120' | '''Signatures'''|{{Func|user:grant|$name as xs:string, $permission as xs:string|empty-sequence()}}<br/>{{Func|user:grant|$name as xs:string, $permission as xs:string, $pattern as xs:string|empty-sequence()}}|-| '''Summary'''|Grants the specified {{Code|$permission}} to a user with the specified {{Code|$name}}. If a glob {{Code|$pattern}} is specified, the permission will only be applied to databases matching that pattern.|-| '''Examples'''|* {{Code|user:grant('John', 'create')}} grants create permissions to the user 'John'.* {{Code|user:grant('John', 'write', 'unit*')}} allows John to write to all databases starting with the letters 'unit'.|-| '''Errors'''|{{Error|name|#Errors}} The specified user name is invalid.|{{Error|pattern|#Errors}} The specified database pattern is invalid.|{{Error|permission|#Errors}} The specified permission is invalid.|{{Error|admin|#Errors}} The "admin" user cannot be modified.|{{Error|local|#Errors}} A local permission can only be 'none', 'read' or 'write'.|{{Error|logged-in|#Errors}} The specified user is currently logged in.|{{Error|update|#Errors}} The operation can only be performed once per user or database pattern.|} ==user:drop== {| width='100%'|-| width='120' | '''Signatures'''|{{Func|user:drop|$name as xs:string|empty-sequence()}}<br/>{{Func|user:drop|$name as xs:string, $pattern as xs:string|empty-sequence()}}|-| '''Summary'''|Drops a user with the specified {{Code|$name}}. If a glob {{Code|$pattern}} is specified, only the database pattern will be dropped.|-| '''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.|-| '''Errors'''|{{Error|name|#Errors}} The specified user name is invalid.|{{Error|pattern|#Errors}} The specified database pattern is invalid.|{{Error|admin|#Errors}} The "admin" user cannot be modified.|{{Error|logged-in|#Errors}} The specified user is currently logged in.|{{Error|update|#Errors}} The operation can only be performed once per user or database pattern.|{{Error|conflict|#Errors}} A user cannot be both altered and dropped.|} ==user:alter== {| width='100%'|-| width='120' | '''Signatures'''|{{Func|user:alter|$name as xs:string, $newname as xs:string|empty-sequence()}}|-| '''Summary'''|Renames a user with the specified {{Code|$name}} to {{Code|$newname}}.|-| '''Examples'''|* {{Code|user:rename('John', 'Jack')}} renames the user 'John' to 'Jack'.|-| '''Errors'''|{{Error|name|#Errors}} The specified user name is invalid.|{{Error|admin|#Errors}} The "admin" user cannot be modified.|{{Error|logged-in|#Errors}} The specified user is currently logged in.|{{Error|update|#Errors}} The operation can only be performed once per user or database pattern.|{{Error|conflict|#Errors}} A user cannot be both altered and dropped.|} ==user:password== {| width='100%'|-| width='120' | '''Signatures'''|{{Func|user:password|$name as xs:string, $password as xs:string|empty-sequence()}}|-| '''Summary'''|Changes the {{Code|password}} of a user with the specified {{Code|$name}}.|-| '''Examples'''|* {{Code|user:password('John', '')}} assigns user 'John' an empty password string.|-| '''Errors'''|{{Error|name|#Errors}} The specified user name is invalid.|{{Error|update|#Errors}} The operation can only be performed once per user or database pattern.
|}
|Description
|-
|{{Code|BXUS0001name}}
|The specified user name is invalid.
|-
|{{Code|BXUS0002pattern}}
|The specified database name is invalid.
|-
|{{Code|BXUS0003permission}}
|The specified permission is invalid.
|-
|{{Code|BXUS0004unknown}}
|The specified user does not exist.
|-
|{{Code|BXUS0005admin}}
|The "admin" user cannot be modified.
|-
|{{Code|BXUS0006equal}}
|Name of old and new user is equal.
|-
|{{Code|BXUS0007local}}
|A local permission can only be 'none', 'read' or 'write'.
|-
|{{Code|BXUS0008logged-in}}|A The specified user is currently logged in.
|-
|{{Code|BXUS0009update}}|A user, or its associated permission, The operation can only be created, modified performed once per user or dropped oncedatabase pattern.
|-
|{{Code|BXUS0010conflict}}
|A user cannot be both altered and dropped.
|}
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu