Difference between revisions of "User Management"

From BaseX Documentation
Jump to navigation Jump to search
Line 1: Line 1:
==User Management==
+
==User==
  
<p>Admin permissions are needed to execute one of the following processes.</p> 
+
Admin permissions are needed to execute one of the following processes.
 
   
 
   
 
===Creating user 'test' with password 'test'===  
 
===Creating user 'test' with password 'test'===  
 
<code>&gt; CREATE USER test test</code>  
 
<code>&gt; CREATE USER test test</code>  
 
   
 
   
<p>As global permissions, you can set 'none', 'read', 'write', 'create' and 'admin':</p>
+
As global permissions, you can set 'none', 'read', 'write', 'create' and 'admin':
 
   
 
   
 
===Revoking all global permissions from user 'test'===  
 
===Revoking all global permissions from user 'test'===  
 
<code>&gt; GRANT none TO test</code>  
 
<code>&gt; GRANT none TO test</code>  
 
   
 
   
<p>Valid local permissions are 'none', 'read' and 'write':</p>
+
Valid local permissions are 'none', 'read' and 'write':
 
   
 
   
 
===Granting write permission on database 'factbook' to user 'test'===  
 
===Granting write permission on database 'factbook' to user 'test'===  
 
<code>&gt; GRANT write ON factbook TO test</code>  
 
<code>&gt; GRANT write ON factbook TO test</code>  
<p>
+
 
 
Note: Local permissions overwrite global permissions.
 
Note: Local permissions overwrite global permissions.
 
As a consequence, the 'test' user will only be allowed to
 
As a consequence, the 'test' user will only be allowed to
Line 21: Line 21:
 
If no local permissions are set, the global rights are
 
If no local permissions are set, the global rights are
 
inherited.
 
inherited.
</p>
 
 
   
 
   
 
===Showing global permissions===  
 
===Showing global permissions===  
Line 32: Line 31:
 
<code>&gt; DROP USER test</code>  
 
<code>&gt; DROP USER test</code>  
  
==Permissions hierarchy==
+
==Permissions==
  
 
In the permission hierarchy the higher permission contains all underlying rights.
 
In the permission hierarchy the higher permission contains all underlying rights.
Line 39: Line 38:
 
[[File:perms.png|none|thumb|200px|Permissions hierarchy]]
 
[[File:perms.png|none|thumb|200px|Permissions hierarchy]]
  
==Commands and Permissions table==
+
==Command Permissions==
  
 
In this table you can see an overview about the BaseX commands and the
 
In this table you can see an overview about the BaseX commands and the
Line 45: Line 44:
 
an error is thrown and the command will not be executed.
 
an error is thrown and the command will not be executed.
  
{| border="1" cellpadding="5" cellspacing="0"
+
{| class="wikitable"
 
!Command
 
!Command
 
!Description
 
!Description

Revision as of 23:38, 5 May 2011

User

Admin permissions are needed to execute one of the following processes.

Creating user 'test' with password 'test'

> CREATE USER test test

As global permissions, you can set 'none', 'read', 'write', 'create' and 'admin':

Revoking all global permissions from user 'test'

> GRANT none TO test

Valid local permissions are 'none', 'read' and 'write':

Granting write permission on database 'factbook' to user 'test'

> GRANT write ON factbook TO test

Note: Local permissions overwrite global permissions. As a consequence, the 'test' user will only be allowed to access (i.e., read and write) the 'factbook' database. If no local permissions are set, the global rights are inherited.

Showing global permissions

> SHOW USERS

Showing local permissions on database 'factbook'

> SHOW USERS ON factbook

Dropping of user 'test'

> DROP USER test

Permissions

In the permission hierarchy the higher permission contains all underlying rights. For example if you have the permission 'write' you also have the permission 'read'.

Permissions hierarchy

Command Permissions

In this table you can see an overview about the BaseX commands and the permission you need to execute the command. Without the needed permission an error is thrown and the command will not be executed.

Command Description Needed Permission
close Closes currently opened database. None
exit Exits BaseX. None
get Returns a property value. None
help Shows the help texts. None
password Changes password of currently logged-in user. None
set Sets a property value. None
xquery Executes a xquery function without database access. None
info Shows information about the currently opened database. Read
list Shows all available databases. Read
open Opens a database. Read
xquery Executes a read-only xquery function with database access. Read
add Adds documents to the currently opened database. Write
create index Creates the specified index. Write
delete Deletes documents from the currently opened database. Write
drop index Drops the specified index. Write
optimize Optimizes the database structure and renews the indexes. Write
xquery Executes a xquery update function. Write
alter db Renames a database. Create
create db Creates a database. Create
drop db Drops a database. Create
export Exports the database content. Create
alter user Changes the password of an user. Admin
create users Creates a new user. Admin
drop user Drops an user. Admin
grant Assigns permissions to users. Admin
kill Kills an user session on the server. Admin
show Shows different server information. Admin