com.openexchange.admin.rmi
Interface OXUserInterface

All Superinterfaces:
Remote

public interface OXUserInterface
extends Remote

This class defines the Open-Xchange API Version 2 for creating and manipulating OX Users within an OX context.

Example:

 final OXUserInterface iface = (OXUserInterface)Naming.lookup("rmi:///oxhost/"+OXUserInterface.RMI_NAME);
 
 final Context ctx = new Context(1);
 
 User usr = new User();
 usr.setDisplay_name("display name");
 usr.setName("name");
 usr.setPassword("secret");  
 usr.setMailenabled(true);       
 usr.setPrimaryEmail("primaryemail@example.org");
 usr.setEmail1("primaryemail@example.org");
 usr.setGiven_name("Givenname");
 usr.setSur_name("Lastname");
 
 final UserModuleAccess access = new UserModuleAccess();  
 access.access.enableAll();  // give access to all modules.
 
 final Credentials auth = new Credentials();
 auth.setLogin("admin");
 auth.setPassword("secret");
 
 User created = iface.create(ctx,usr,access,auth);
  
 

Author:
Manuel Kraft, Carsten Hoeger, Dennis Sieben

Field Summary
static String RMI_NAME
          RMI name to be used in the naming lookup.
 
Method Summary
 void change(Context ctx, User usrdata, Credentials auth)
          Manipulate user data within the given context.
 void changeModuleAccess(Context ctx, User user, String access_combination_name, Credentials auth)
          Manipulate user module access within the given context.
 void changeModuleAccess(Context ctx, User user, UserModuleAccess moduleAccess, Credentials auth)
          Manipulate user module access within the given context.
 void changeModuleAccessGlobal(String filter, UserModuleAccess addAccess, UserModuleAccess removeAccess, Credentials auth)
          This method changes module Permissions for all (!) users in all (!) contexts.
 User create(Context ctx, User usrdata, Credentials auth)
          Creates a new user within the given context.
Default context access rights are used!
 User create(Context ctx, User usrdata, String access_combination_name, Credentials auth)
          Creates a new user within the given context.
 User create(Context ctx, User usrdata, UserModuleAccess access, Credentials auth)
          Creates a new user within the given context.
 void delete(Context ctx, User[] users, Credentials auth)
          Delete user from given context.
 void delete(Context ctx, User user, Credentials auth)
          Delete user from given context.
 boolean exists(Context ctx, User user, Credentials auth)
          Check whether the given user exists.
 String getAccessCombinationName(Context ctx, User user, Credentials auth)
          Get current access combination name of an user!
 User getContextAdmin(Context ctx, Credentials auth)
          Returns the Context admin User object
 UserModuleAccess getContextAdminUserModuleAccess(Context ctx, Credentials auth)
          Returns the module access rights of the context-admin
 User[] getData(Context ctx, User[] users, Credentials auth)
          Retrieve user objects for a range of users by username or id.
 User getData(Context ctx, User user, Credentials auth)
          Retrieve user objects for a range of users by username or id.
 UserModuleAccess getModuleAccess(Context ctx, User user, Credentials auth)
          Retrieve the ModuleAccess for an user.
 User[] list(Context ctx, String search_pattern, Credentials auth)
          Retrieve all users for a given context.
 User[] listAll(Context ctx, Credentials auth)
          Retrieve all users for a given context.
 User[] listCaseInsensitive(Context ctx, String search_pattern, Credentials auth)
          Retrieve all users for a given context.
 

Field Detail

RMI_NAME

static final String RMI_NAME
RMI name to be used in the naming lookup.

See Also:
Constant Field Values
Method Detail

create

User create(Context ctx,
            User usrdata,
            UserModuleAccess access,
            Credentials auth)
            throws RemoteException,
                   StorageException,
                   InvalidCredentialsException,
                   NoSuchContextException,
                   InvalidDataException,
                   DatabaseUpdateException
Creates a new user within the given context.

Parameters:
context - Context in which the new user will exist.
usrdata - User containing user data.
auth - Credentials for authenticating against server.
access - UserModuleAccess containing module access for the user.
Returns:
int containing the id of the new user.
Throws:
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occurred.
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
NoSuchContextException - If the context does not exist in the system.
InvalidDataException - If the data sent within the method contained invalid data.
DatabaseUpdateException

create

User create(Context ctx,
            User usrdata,
            String access_combination_name,
            Credentials auth)
            throws RemoteException,
                   StorageException,
                   InvalidCredentialsException,
                   NoSuchContextException,
                   InvalidDataException,
                   DatabaseUpdateException
Creates a new user within the given context.

Parameters:
context - Context in which the new user will exist.
usrdata - User containing user data.
auth - Credentials for authenticating against server.
access_combination_name - Access combination name identifying the module rights for the new user.
Returns:
int containing the id of the new user.
Throws:
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occurred.
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
NoSuchContextException - If the context does not exist in the system.
InvalidDataException - If the data sent within the method contained invalid data.
DatabaseUpdateException

create

User create(Context ctx,
            User usrdata,
            Credentials auth)
            throws RemoteException,
                   StorageException,
                   InvalidCredentialsException,
                   NoSuchContextException,
                   InvalidDataException,
                   DatabaseUpdateException
Creates a new user within the given context.
Default context access rights are used!

Parameters:
context - Context in which the new user will exist.
usrdata - User containing user data.
auth - Credentials for authenticating against server.
Returns:
int containing the id of the new user.
Throws:
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occurred.
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
NoSuchContextException - If the context does not exist in the system.
InvalidDataException - If the data sent within the method contained invalid data.
DatabaseUpdateException

getContextAdminUserModuleAccess

UserModuleAccess getContextAdminUserModuleAccess(Context ctx,
                                                 Credentials auth)
                                                 throws RemoteException,
                                                        StorageException,
                                                        InvalidCredentialsException,
                                                        NoSuchContextException,
                                                        InvalidDataException,
                                                        DatabaseUpdateException
Returns the module access rights of the context-admin

Parameters:
context - Context
auth - Credentials for authenticating against server.
Returns:
int containing the id of the new user.
Throws:
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occurred.
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
NoSuchContextException - If the context does not exist in the system.
InvalidDataException - If the data sent within the method contained invalid data.
DatabaseUpdateException

getContextAdmin

User getContextAdmin(Context ctx,
                     Credentials auth)
                     throws RemoteException,
                            InvalidCredentialsException,
                            StorageException,
                            InvalidDataException
Returns the Context admin User object

Parameters:
ctx -
auth -
Returns:
Throws:
RemoteException
InvalidCredentialsException
StorageException
InvalidDataException

change

void change(Context ctx,
            User usrdata,
            Credentials auth)
            throws RemoteException,
                   StorageException,
                   InvalidCredentialsException,
                   NoSuchContextException,
                   InvalidDataException,
                   DatabaseUpdateException,
                   NoSuchUserException
Manipulate user data within the given context.

Parameters:
context - Context in which the new user will be modified.
usrdata - User containing user data.
auth - Credentials for authenticating against server.
Throws:
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occurred.
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
NoSuchContextException - If the context does not exist in the system.
InvalidDataException - If the data sent within the method contained invalid data.
DatabaseUpdateException
NoSuchUserException

delete

void delete(Context ctx,
            User[] users,
            Credentials auth)
            throws RemoteException,
                   StorageException,
                   InvalidCredentialsException,
                   NoSuchContextException,
                   InvalidDataException,
                   DatabaseUpdateException,
                   NoSuchUserException
Delete user from given context.

Parameters:
context - Context in which the new user will be deleted.
users - user array containing user object.
auth - Credentials for authenticating against server.
Throws:
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occurred.
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
NoSuchContextException - If the context does not exist in the system.
InvalidDataException - If the data sent within the method contained invalid data.
DatabaseUpdateException
NoSuchUserException

delete

void delete(Context ctx,
            User user,
            Credentials auth)
            throws RemoteException,
                   StorageException,
                   InvalidCredentialsException,
                   NoSuchContextException,
                   InvalidDataException,
                   DatabaseUpdateException,
                   NoSuchUserException
Delete user from given context.

Parameters:
context - Context in which the new user will be deleted.
user - user object.
auth - Credentials for authenticating against server.
Throws:
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occurred.
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
NoSuchContextException - If the context does not exist in the system.
InvalidDataException - If the data sent within the method contained invalid data.
DatabaseUpdateException
NoSuchUserException

getModuleAccess

UserModuleAccess getModuleAccess(Context ctx,
                                 User user,
                                 Credentials auth)
                                 throws RemoteException,
                                        StorageException,
                                        InvalidCredentialsException,
                                        NoSuchContextException,
                                        InvalidDataException,
                                        DatabaseUpdateException,
                                        NoSuchUserException
Retrieve the ModuleAccess for an user.

Parameters:
context - Context
user_id - int containing the user id.
auth - Credentials for authenticating against server.
Returns:
UserModuleAccess containing the module access rights.
Throws:
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occurred.
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
NoSuchContextException - If the context does not exist in the system.
InvalidDataException - If the data sent within the method contained invalid data.
DatabaseUpdateException
NoSuchUserException

getAccessCombinationName

String getAccessCombinationName(Context ctx,
                                User user,
                                Credentials auth)
                                throws RemoteException,
                                       StorageException,
                                       InvalidCredentialsException,
                                       NoSuchContextException,
                                       InvalidDataException,
                                       DatabaseUpdateException,
                                       NoSuchUserException
Get current access combination name of an user!

Parameters:
ctx -
user -
auth -
Returns:
Access combination name or null if current access rights cannot be mapped to an access combination name.
Throws:
RemoteException
InvalidCredentialsException
NoSuchContextException
StorageException
InvalidDataException
DatabaseUpdateException
NoSuchUserException

changeModuleAccess

void changeModuleAccess(Context ctx,
                        User user,
                        UserModuleAccess moduleAccess,
                        Credentials auth)
                        throws RemoteException,
                               StorageException,
                               InvalidCredentialsException,
                               NoSuchContextException,
                               InvalidDataException,
                               DatabaseUpdateException,
                               NoSuchUserException
Manipulate user module access within the given context.

Parameters:
ctx - Context object.
user_id - int containing the user id.
moduleAccess - UserModuleAccess containing module access.
auth - Credentials for authenticating against server.
Throws:
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occurred.
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
NoSuchContextException - If the context does not exist in the system.
InvalidDataException - If the data sent within the method contained invalid data.
DatabaseUpdateException
NoSuchUserException

changeModuleAccess

void changeModuleAccess(Context ctx,
                        User user,
                        String access_combination_name,
                        Credentials auth)
                        throws RemoteException,
                               StorageException,
                               InvalidCredentialsException,
                               NoSuchContextException,
                               InvalidDataException,
                               DatabaseUpdateException,
                               NoSuchUserException
Manipulate user module access within the given context.

Parameters:
ctx - Context object.
user_id - int containing the user id.
access - String containing access combination name.
auth - Credentials for authenticating against server.
Throws:
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occurred.
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
NoSuchContextException - If the context does not exist in the system.
InvalidDataException - If the data sent within the method contained invalid data.
DatabaseUpdateException
NoSuchUserException

changeModuleAccessGlobal

void changeModuleAccessGlobal(String filter,
                              UserModuleAccess addAccess,
                              UserModuleAccess removeAccess,
                              Credentials auth)
                              throws RemoteException,
                                     InvalidCredentialsException,
                                     StorageException,
                                     InvalidDataException
This method changes module Permissions for all (!) users in all (!) contexts. This can be filtered by already existing access combinations. If no filter is given, all users are changed.

Parameters:
filter - The call affects only users with exactly this access combination. This is either a String representing a defined module access combination or an Integer (masked as String) for direct definitions. null for no filter.
addAccess - Access rights to be added
removeAccess - Access rights to be removed
auth - Credentials for authenticating against server. Must be the master Admin.
Throws:
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
StorageException - When an error in the subsystems occured.
InvalidDataException - If the data sent within the method contained invalid data.
RemoteException - General RMI Exception

getData

User[] getData(Context ctx,
               User[] users,
               Credentials auth)
               throws RemoteException,
                      StorageException,
                      InvalidCredentialsException,
                      NoSuchContextException,
                      InvalidDataException,
                      NoSuchUserException,
                      DatabaseUpdateException
Retrieve user objects for a range of users by username or id.

Parameters:
context - Context object.
users - User[] with users to get data for.
auth - Credentials for authenticating against server.
Returns:
User[] containing result objects.
Throws:
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occured.
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
NoSuchContextException - If the context does not exist in the system.
InvalidDataException - If the data sent within the method contained invalid data.
NoSuchUserException
DatabaseUpdateException
See Also:
User.getUsername().

getData

User getData(Context ctx,
             User user,
             Credentials auth)
             throws RemoteException,
                    StorageException,
                    InvalidCredentialsException,
                    NoSuchContextException,
                    InvalidDataException,
                    NoSuchUserException,
                    DatabaseUpdateException
Retrieve user objects for a range of users by username or id.

Parameters:
context - Context object.
user - user object with user to get data for.
auth - Credentials for authenticating against server.
Returns:
User containing result object.
Throws:
RemoteException - General RMI Exception
StorageException - When an error in the subsystems occured.
InvalidCredentialsException - When the supplied credentials were not correct or invalid.
NoSuchContextException - If the context does not exist in the system.
InvalidDataException - If the data sent within the method contained invalid data.
NoSuchUserException
DatabaseUpdateException
See Also:
User.getUsername().

list

User[] list(Context ctx,
            String search_pattern,
            Credentials auth)
            throws RemoteException,
                   StorageException,
                   InvalidCredentialsException,
                   NoSuchContextException,
                   InvalidDataException,
                   DatabaseUpdateException
Retrieve all users for a given context. The search pattern is directly transformed into a SQL LIKE string comparison, where
a * is transformed into a %
a % and a _ must be escaped by a \ (e.g. if you want to search for _doe, use the pattern \_doe

Parameters:
ctx - Context object.
search_pattern - A pattern to search for
auth - Credentials for authenticating against server.
Returns:
User[] with currently ONLY id set in each User.
Throws:
RemoteException
StorageException
InvalidCredentialsException
NoSuchContextException
InvalidDataException
DatabaseUpdateException

listCaseInsensitive

User[] listCaseInsensitive(Context ctx,
                           String search_pattern,
                           Credentials auth)
                           throws RemoteException,
                                  StorageException,
                                  InvalidCredentialsException,
                                  NoSuchContextException,
                                  InvalidDataException,
                                  DatabaseUpdateException
Retrieve all users for a given context. The search pattern is directly transformed into a SQL LIKE string comparison, where
a * is transformed into a %
a % and a _ must be escaped by a \ (e.g. if you want to search for _doe, use the pattern \_doe

Parameters:
ctx - Context object.
search_pattern - A pattern to search for
auth - Credentials for authenticating against server.
Returns:
User[] with currently ONLY id set in each User.
Throws:
RemoteException
StorageException
InvalidCredentialsException
NoSuchContextException
InvalidDataException
DatabaseUpdateException

listAll

User[] listAll(Context ctx,
               Credentials auth)
               throws RemoteException,
                      StorageException,
                      InvalidCredentialsException,
                      NoSuchContextException,
                      InvalidDataException,
                      DatabaseUpdateException
Retrieve all users for a given context. The same as calling list with a search_pattern of "*"

Parameters:
ctx - Context object.
auth - Credentials for authenticating against server.
Returns:
User[] with currently ONLY id set in each User.
Throws:
RemoteException
StorageException
InvalidCredentialsException
NoSuchContextException
InvalidDataException
DatabaseUpdateException

exists

boolean exists(Context ctx,
               User user,
               Credentials auth)
               throws RemoteException,
                      InvalidDataException,
                      InvalidCredentialsException,
                      StorageException,
                      DatabaseUpdateException,
                      NoSuchContextException
Check whether the given user exists. Either users id or name must be set.

Parameters:
ctx -
user -
Returns:
Throws:
RemoteException
InvalidDataException
InvalidCredentialsException
StorageException
DatabaseUpdateException
NoSuchContextException