org.exist.xmldb
Class LocalUserManagementService

java.lang.Object
  extended byorg.exist.xmldb.LocalUserManagementService
All Implemented Interfaces:
Configurable, Service, UserManagementService

public class LocalUserManagementService
extends java.lang.Object
implements UserManagementService


Constructor Summary
LocalUserManagementService(User user, BrokerPool pool, LocalCollection collection)
           
 
Method Summary
 void addUser(User u)
          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 resource)
          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 u)
          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 u)
          Update existing user information
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalUserManagementService

public LocalUserManagementService(User user,
                                  BrokerPool pool,
                                  LocalCollection collection)
Method Detail

addUser

public void addUser(User u)
             throws XMLDBException
Description copied from interface: UserManagementService
Add a new user to the database

Specified by:
addUser in interface UserManagementService
Parameters:
u - The feature to be added to the User attribute
Throws:
XMLDBException - Description of the Exception

setPermissions

public void setPermissions(Resource resource,
                           Permission perm)
                    throws XMLDBException
Description copied from interface: UserManagementService
Set permissions for the specified resource.

Specified by:
setPermissions in interface UserManagementService
Parameters:
resource -
perm -
Throws:
XMLDBException

setPermissions

public void setPermissions(Collection child,
                           Permission perm)
                    throws XMLDBException
Description copied from interface: UserManagementService
Set permissions for the specified collection.

Specified by:
setPermissions in interface UserManagementService
Parameters:
child -
perm -
Throws:
XMLDBException

chmod

public void chmod(java.lang.String modeStr)
           throws XMLDBException
Description copied from interface: UserManagementService
Change permissions for the current collection

Specified by:
chmod in interface UserManagementService
Parameters:
modeStr - String describing the permissions to grant or deny.
Throws:
XMLDBException

chmod

public void chmod(Resource resource,
                  int mode)
           throws XMLDBException
Description copied from interface: UserManagementService
Change permissions for the specified resource.

Specified by:
chmod in interface UserManagementService
Throws:
XMLDBException

chmod

public void chmod(int mode)
           throws XMLDBException
Specified by:
chmod in interface UserManagementService
Throws:
XMLDBException

chmod

public void chmod(Resource resource,
                  java.lang.String modeStr)
           throws XMLDBException
Description copied from interface: UserManagementService
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.

Specified by:
chmod in interface UserManagementService
Parameters:
resource - Description of the Parameter
modeStr - Description of the Parameter
Throws:
XMLDBException - Description of the Exception

chown

public void chown(User u,
                  java.lang.String group)
           throws XMLDBException
Description copied from interface: UserManagementService
Change owner and group of the current collection.

Specified by:
chown in interface UserManagementService
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
Description copied from interface: UserManagementService
Change owner and group of the specified resource.

Specified by:
chown in interface UserManagementService
Parameters:
res - Description of the Parameter
u - Description of the Parameter
group - Description of the Parameter
Throws:
XMLDBException - Description of the Exception

hasUserLock

public java.lang.String hasUserLock(Resource res)
                             throws XMLDBException
Description copied from interface: UserManagementService
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.

Specified by:
hasUserLock in interface UserManagementService
Parameters:
res -
Throws:
XMLDBException

lockResource

public void lockResource(Resource res,
                         User u)
                  throws XMLDBException
Description copied from interface: UserManagementService
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.

Specified by:
lockResource in interface UserManagementService
Parameters:
res -
u -
Throws:
XMLDBException

unlockResource

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

Specified by:
unlockResource in interface UserManagementService
Parameters:
res -
Throws:
XMLDBException

getName

public java.lang.String getName()
Description copied from interface: UserManagementService
Get the name of this service

Specified by:
getName in interface UserManagementService
Returns:
The name

getPermissions

public Permission getPermissions(Collection coll)
                          throws XMLDBException
Description copied from interface: UserManagementService
Get permissions for the specified collections

Specified by:
getPermissions in interface UserManagementService
Parameters:
coll - Description of the Parameter
Returns:
The permissions value
Throws:
XMLDBException - Description of the Exception

getPermissions

public Permission getPermissions(Resource resource)
                          throws XMLDBException
Description copied from interface: UserManagementService
Get permissions for the specified resource

Specified by:
getPermissions in interface UserManagementService
Parameters:
resource - Description of the Parameter
Returns:
The permissions value
Throws:
XMLDBException - Description of the Exception

listResourcePermissions

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

Specified by:
listResourcePermissions in interface UserManagementService
Returns:
Permission[]
Throws:
XMLDBException

listCollectionPermissions

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

Specified by:
listCollectionPermissions in interface UserManagementService
Returns:
Permission[]
Throws:
XMLDBException

getProperty

public java.lang.String getProperty(java.lang.String property)
                             throws XMLDBException
Description copied from interface: UserManagementService
Get a property defined by this service.

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

getUser

public User getUser(java.lang.String name)
             throws XMLDBException
Description copied from interface: UserManagementService
Get a user record from the database

Specified by:
getUser in interface UserManagementService
Parameters:
name - Description of the Parameter
Returns:
The user value
Throws:
XMLDBException - Description of the Exception

getUsers

public User[] getUsers()
                throws XMLDBException
Description copied from interface: UserManagementService
Retrieve a list of all existing users.

Specified by:
getUsers in interface UserManagementService
Returns:
The users value
Throws:
XMLDBException - Description of the Exception

getGroups

public java.lang.String[] getGroups()
                             throws XMLDBException
Description copied from interface: UserManagementService
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.

Specified by:
getGroups in interface UserManagementService
Throws:
XMLDBException

getVersion

public java.lang.String getVersion()
Description copied from interface: UserManagementService
Get the version of this service

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

removeUser

public void removeUser(User u)
                throws XMLDBException
Description copied from interface: UserManagementService
Delete a user from the database

Specified by:
removeUser in interface UserManagementService
Parameters:
u -
Throws:
XMLDBException

setCollection

public void setCollection(Collection collection)
                   throws XMLDBException
Description copied from interface: UserManagementService
Set the current collection for this service

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

setProperty

public void setProperty(java.lang.String property,
                        java.lang.String value)
                 throws XMLDBException
Description copied from interface: UserManagementService
Set a property for this service.

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

updateUser

public void updateUser(User u)
                throws XMLDBException
Description copied from interface: UserManagementService
Update existing user information

Specified by:
updateUser in interface UserManagementService
Parameters:
u - Description of the Parameter
Throws:
XMLDBException - Description of the Exception


Copyright (C) Wolfgang Meier. All rights reserved.