org.exist.xmldb
Interface UserManagementService

All Superinterfaces:
Configurable, Service
All Known Implementing Classes:
LocalUserManagementService, RemoteUserManagementService

public interface UserManagementService
extends Service

An eXist-specific service which provides methods to manage users and permissions.

Author:
Wolfgang Meier

Method Summary
 void addUser(User user)
          Add a new user to the database
 void chmod(int mode)
           
 void chmod(Resource resource, int mode)
          Change permissions for the specified resource.
 void chmod(Resource resource, java.lang.String modeStr)
          Change permissions for the specified resource.
 void chmod(java.lang.String modeStr)
          Change permissions for the current collection
 void chown(Resource res, User u, java.lang.String group)
          Change owner and group of the specified resource.
 void chown(User u, java.lang.String group)
          Change owner and group of the current collection.
 java.lang.String[] getGroups()
          Retrieve a list of all existing groups.
 java.lang.String getName()
          Get the name of this service
 Permission getPermissions(Collection coll)
          Get permissions for the specified collections
 Permission getPermissions(Resource res)
          Get permissions for the specified resource
 java.lang.String getProperty(java.lang.String property)
          Get a property defined by this service.
 User getUser(java.lang.String name)
          Get a user record from the database
 User[] getUsers()
          Retrieve a list of all existing users.
 java.lang.String getVersion()
          Get the version of this service
 java.lang.String hasUserLock(Resource res)
          Check if the resource has a user lock.
 Permission[] listCollectionPermissions()
          Get permissions for all child collections contained in the current collection.
 Permission[] listResourcePermissions()
          Get permissions for all resources contained in the current collection.
 void lockResource(Resource res, User u)
          Lock the specified resource for the specified user.
 void removeUser(User user)
          Delete a user from the database
 void setCollection(Collection collection)
          Set the current collection for this service
 void setPermissions(Collection child, Permission perm)
          Set permissions for the specified collection.
 void setPermissions(Resource resource, Permission perm)
          Set permissions for the specified resource.
 void setProperty(java.lang.String property, java.lang.String value)
          Set a property for this service.
 void unlockResource(Resource res)
          Unlock the specified resource.
 void updateUser(User user)
          Update existing user information
 

Method Detail

getName

public java.lang.String getName()
Get the name of this service

Specified by:
getName in interface Service
Returns:
The name

getVersion

public java.lang.String getVersion()
Get the version of this service

Specified by:
getVersion in interface Service
Returns:
The version value

setPermissions

public void setPermissions(Collection child,
                           Permission perm)
                    throws XMLDBException
Set permissions for the specified collection.

Parameters:
child -
perm -
Throws:
XMLDBException

setPermissions

public void setPermissions(Resource resource,
                           Permission perm)
                    throws XMLDBException
Set permissions for the specified resource.

Parameters:
resource -
perm -
Throws:
XMLDBException

chown

public void chown(User u,
                  java.lang.String group)
           throws XMLDBException
Change owner and group of the current collection.

Parameters:
u - Description of the Parameter
group - Description of the Parameter
Throws:
XMLDBException - Description of the Exception

chown

public void chown(Resource res,
                  User u,
                  java.lang.String group)
           throws XMLDBException
Change owner and group of the specified resource.

Parameters:
res - Description of the Parameter
u - Description of the Parameter
group - Description of the Parameter
Throws:
XMLDBException - Description of the Exception

chmod

public void chmod(Resource resource,
                  java.lang.String modeStr)
           throws XMLDBException
Change permissions for the specified resource. Permissions are specified in a string according to the following format:
[user|group|other]=[+|-][read|write|update]
For example, to grant all permissions to the group and deny everything to others: group=+write,+read,+update,other=-read The changes are applied to the permissions currently active for this resource.

Parameters:
resource - Description of the Parameter
modeStr - Description of the Parameter
Throws:
XMLDBException - Description of the Exception

chmod

public void chmod(java.lang.String modeStr)
           throws XMLDBException
Change permissions for the current collection

Parameters:
modeStr - String describing the permissions to grant or deny.
Throws:
XMLDBException

chmod

public void chmod(int mode)
           throws XMLDBException
Throws:
XMLDBException

chmod

public void chmod(Resource resource,
                  int mode)
           throws XMLDBException
Change permissions for the specified resource.

Throws:
XMLDBException

lockResource

public void lockResource(Resource res,
                         User u)
                  throws XMLDBException
Lock the specified resource for the specified user. A locked resource cannot be changed by other users (except users in group DBA) until the lock is released. Users with admin privileges can always change a resource.

Parameters:
res -
u -
Throws:
XMLDBException

hasUserLock

public java.lang.String hasUserLock(Resource res)
                             throws XMLDBException
Check if the resource has a user lock. Returns the name of the owner of the lock or null if no lock has been set on the resource.

Parameters:
res -
Throws:
XMLDBException

unlockResource

public void unlockResource(Resource res)
                    throws XMLDBException
Unlock the specified resource. The current user has to be same who locked the resource. Exception: admin users can always unlock a resource.

Parameters:
res -
Throws:
XMLDBException

addUser

public void addUser(User user)
             throws XMLDBException
Add a new user to the database

Parameters:
user - The feature to be added to the User attribute
Throws:
XMLDBException - Description of the Exception

updateUser

public void updateUser(User user)
                throws XMLDBException
Update existing user information

Parameters:
user - Description of the Parameter
Throws:
XMLDBException - Description of the Exception

getUser

public User getUser(java.lang.String name)
             throws XMLDBException
Get a user record from the database

Parameters:
name - Description of the Parameter
Returns:
The user value
Throws:
XMLDBException - Description of the Exception

getUsers

public User[] getUsers()
                throws XMLDBException
Retrieve a list of all existing users.

Returns:
The users value
Throws:
XMLDBException - Description of the Exception

getGroups

public java.lang.String[] getGroups()
                             throws XMLDBException
Retrieve a list of all existing groups. Please note: new groups are created automatically if a new group is assigned to a user. You can't add or remove them.

Throws:
XMLDBException

getProperty

public java.lang.String getProperty(java.lang.String property)
                             throws XMLDBException
Get a property defined by this service.

Specified by:
getProperty in interface Configurable
Parameters:
property - Description of the Parameter
Returns:
The property value
Throws:
XMLDBException - Description of the Exception

setProperty

public void setProperty(java.lang.String property,
                        java.lang.String value)
                 throws XMLDBException
Set a property for this service.

Specified by:
setProperty in interface Configurable
Parameters:
property - The new property value
value - The new property value
Throws:
XMLDBException - Description of the Exception

setCollection

public void setCollection(Collection collection)
                   throws XMLDBException
Set the current collection for this service

Specified by:
setCollection in interface Service
Parameters:
collection - The new collection value
Throws:
XMLDBException - Description of the Exception

getPermissions

public Permission getPermissions(Collection coll)
                          throws XMLDBException
Get permissions for the specified collections

Parameters:
coll - Description of the Parameter
Returns:
The permissions value
Throws:
XMLDBException - Description of the Exception

getPermissions

public Permission getPermissions(Resource res)
                          throws XMLDBException
Get permissions for the specified resource

Parameters:
res - Description of the Parameter
Returns:
The permissions value
Throws:
XMLDBException - Description of the Exception

listResourcePermissions

public Permission[] listResourcePermissions()
                                     throws XMLDBException
Get permissions for all resources contained in the current collection. Returns a list of permissions in the same order as Collection.listResources().

Returns:
Permission[]
Throws:
XMLDBException

listCollectionPermissions

public Permission[] listCollectionPermissions()
                                       throws XMLDBException
Get permissions for all child collections contained in the current collection. Returns a list of permissions in the same order as Collection.listChildCollections().

Returns:
Permission[]
Throws:
XMLDBException

removeUser

public void removeUser(User user)
                throws XMLDBException
Delete a user from the database

Parameters:
user -
Throws:
XMLDBException


Copyright (C) Wolfgang Meier. All rights reserved.