|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.uka.ipd.consensus.foundation.AbstractConsensusFoundationModule de.uka.ipd.consensus.impl.UserManagerImpl
TODO
Field Summary | |
static String |
ROLE_ADMIN
|
static String |
ROLE_SUPERADMIN
|
static String |
USERDATA_COMMENT_KEY
|
static String |
USERDATA_EMAIL_KEY
|
static String |
USERDATA_FIRSTNAME_KEY
|
static String |
USERDATA_LASTNAME_KEY
|
Constructor Summary | |
UserManagerImpl()
|
Method Summary | |
void |
addUserListener(UserListener listener)
Registers a new UserListener. |
protected void |
assignSystemRoles(User user)
|
void |
changeUser(User user,
String oldPassword,
String newPassword,
Map data)
Changes an existing user account. |
User |
createUser(String username,
String password,
Map data)
Creates a new user accout with the given username and password, and sets the new user's status to "logged on". |
void |
deleteUser(User user,
String password)
Deletes a user account permanently from the user database. |
UserRole |
findRole(String rolename)
Returns a UserRole by the given name (e.g. |
protected void |
fireUserCreated(User user)
|
protected void |
fireUserLoggedIn(User user)
|
protected void |
fireUserLoggedOut(User user)
|
Collection |
getRoles()
Returns a collection of all UserRole objects that the UserManager provides. |
User |
getUserById(String userid)
Returns a User with the given id. |
User |
getUserByUsername(String username)
Returns a User with the given username. |
Iterator |
getUsers()
Returns all users in the user database. |
String |
getVersion()
Returns a version string of the implementation of this module. |
void |
init(Properties config,
LoggingManager logging)
This method is called by the ConsensusFoundation constructor to initialize the UserManager.
|
void |
initCompleted(Properties config,
ConsensusFoundationManager cfm)
This method is called by the ConsensusFoundation constructor after all available modules have
been initialized (i.e. their init() method has been called). |
protected void |
loadUserData(UserImpl user)
|
User |
login(String username,
String password)
Loads a user by the given username and password and sets his status to "logged on". |
void |
logout(User user)
Sets a user's status to "logged off". |
void |
removeUserListener(UserListener listener)
Removes an UserListener, if it is registered with the UserManager (otherwise this call is ignored). |
protected void |
saveUserComment(User user)
|
protected void |
saveUserRoles(User user)
|
protected void |
saveUserScore(User user)
|
void |
shutdown()
Called by ConsensusFoundation.shutdown() when the application shuts down.
|
Methods inherited from class de.uka.ipd.consensus.foundation.AbstractConsensusFoundationModule |
finalize, getConsensusFoundationManager, getDynamicRightsManager, getEvolutionManager, getIncentiveManager, getLoggingManager, getOntologyManager, getRatingManager, getUserManager |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface de.uka.ipd.consensus.foundation.ConsensusFoundationModule |
getConsensusFoundationManager |
Field Detail |
public static final String USERDATA_FIRSTNAME_KEY
public static final String USERDATA_LASTNAME_KEY
public static final String USERDATA_EMAIL_KEY
public static final String USERDATA_COMMENT_KEY
public static final String ROLE_SUPERADMIN
public static final String ROLE_ADMIN
Constructor Detail |
public UserManagerImpl()
Method Detail |
public void init(Properties config, LoggingManager logging) throws Exception
UserManager
This method is called by the ConsensusFoundation
constructor to initialize the UserManager.
The UserManager should create default user roles here (e.g. an admin role).
init
in interface UserManager
config
- all entries from ConsensusFoundation.properties
logging
- the successfully initialized LoggingManager instance
Exception
- if any error occurs (startup of the application is aborted in this case)ConsensusFoundation.ConsensusFoundation()
public void initCompleted(Properties config, ConsensusFoundationManager cfm) throws Exception
ConsensusFoundationModule
ConsensusFoundation
constructor after all available modules have
been initialized (i.e. their init()
method has been called). Here a module can perform some final
initialization that is dependant on other modules.
initCompleted
in interface ConsensusFoundationModule
initCompleted
in class AbstractConsensusFoundationModule
Exception
public void shutdown()
ConsensusFoundationModule
ConsensusFoundation.shutdown()
when the application shuts down.
When implementing this method make sure that the shutdown code is executed only once even if this method is called multiple times.
shutdown
in interface ConsensusFoundationModule
shutdown
in class AbstractConsensusFoundationModule
public User login(String username, String password) throws UserManagerException
UserManager
login
in interface UserManager
username
- the username for the user to be loaded and logged onpassword
- the password for the username
UserManagerException
- if the username does not exist or the password is wrongUser.isLoggedOn()
public void logout(User user) throws UserManagerException
UserManager
logout
in interface UserManager
user
- the user to be logged off
UserManagerException
- if the user isn't logged onUser.isLoggedOn()
public User createUser(String username, String password, Map data) throws UserManagerException
UserManager
An implementation can define keys for passing additional user information (first name, last name, e-mail address etc.) in the data map.
createUser
in interface UserManager
username
- the username for the new user accountpassword
- the password for the usernamedata
- implementation-specific data
UserManagerException
- if the username is invalid or already in usepublic void changeUser(User user, String oldPassword, String newPassword, Map data) throws UserManagerException
UserManager
changeUser
in interface UserManager
user
- the User object to be changedoldPassword
- the old password or null
if the password is not to be changednewPassword
- a new password or null
if the password is not to be changeddata
- implementation-specific data (e.g. for the real name and e-mail address)
UserManagerException
- if the user data could not be changedpublic void deleteUser(User user, String password) throws UserManagerException
UserManager
deleteUser
in interface UserManager
user
- the user account to be deletedpassword
- the password for the account
UserManagerException
- if the user account could not be deletedpublic User getUserByUsername(String username) throws UserManagerException
UserManager
getUserByUsername
in interface UserManager
username
- the username of the user to be returned
null
if no user with the given username exists
UserManagerException
- if the user data could not be readUser.getUsername()
public User getUserById(String userid) throws UserManagerException
UserManager
getUserById
in interface UserManager
userid
- the id of the user to be returned
null
if no user with the given id exists
UserManagerException
- if the user data could not be readUser.getId()
public UserRole findRole(String rolename)
UserManager
findRole
in interface UserManager
rolename
- the name of the role to be returned
null
if no role with the given name existspublic Collection getRoles()
UserManager
getRoles
in interface UserManager
UserRole
protected void assignSystemRoles(User user)
public void addUserListener(UserListener listener)
UserManager
addUserListener
in interface UserManager
listener
- the UserListener to be addedpublic void removeUserListener(UserListener listener)
UserManager
removeUserListener
in interface UserManager
listener
- the UserListener to be removedprotected void fireUserLoggedIn(User user)
protected void fireUserLoggedOut(User user)
protected void fireUserCreated(User user)
protected void saveUserScore(User user)
protected void saveUserComment(User user)
protected void saveUserRoles(User user)
protected void loadUserData(UserImpl user)
public String getVersion()
ConsensusFoundationModule
getVersion
in interface ConsensusFoundationModule
public Iterator getUsers() throws UserManagerException
UserManager
getUsers
in interface UserManager
UserManagerException
- if the users could not be readUser
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |