|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mycore.user.MCRUserMgr
public class MCRUserMgr
This class is the user (and group) manager of the MyCoRe system. It is implemented using the singleton design pattern in order to ensure that there is only one instance of this class, i.e. one user manager, running. The user manager has several responsibilities. First it serves as a facade for client classes such as MyCoRe-Servlets to retrieve objects from the persistent datastore. Then the manager is used by the user and group objects themselves to manage their existence in the underlying datastore.
| Method Summary | |
|---|---|
void |
checkConsistency()
This method checks the consistency of the user and group data. |
void |
createGroup(MCRGroup group)
This method creates a group in the datastore (and the group cache as well). |
void |
createUser(MCRUser user)
This method creates a user in the datastore (and the user cache as well). |
void |
deleteGroup(String groupID)
This method deletes a group from the datastore (and the group cache as well). |
void |
deleteUser(String userID)
This method deletes a user from the datastore (and the user cache as well). |
void |
disableUser(String userID)
This method disables the user. |
void |
enableUser(String userID)
This method enables the user. |
boolean |
existGroup(String group)
The method check that a group entry exists. |
boolean |
existUser(String user)
The method check that an user entry exists. |
List<String> |
getAllGroupIDs()
This method gets all group IDs from the persistent datastore and returns them as a ArrayList of strings. |
Document |
getAllGroups()
This method returns a JDOM presentation of all groups of the system |
List<String> |
getAllUserIDs()
This method gets all user IDs from the persistent datastore and returns them as an ArrayList of strings. |
Document |
getAllUsers()
This method returns a JDOM presentation of all users of the system |
MCRUser |
getCurrentUser()
The access control subsystem needs to know the current working user. |
Set<MCRGroup> |
getGroupsContainingUser(MCRUser user,
Set<MCRGroup> groups)
This method determines in which groups of a given set of groups a given user is a member of. |
List<String> |
getGroupsContainingUser(String user)
This method determines in which groups is the user member. |
int |
getMaxUserNumID()
This method returns the maximum value of the numerical user IDs |
String |
getPrimaryGroupIDOfUser(String userID)
This method returns the ID of the primary group for a given userID. |
void |
importUserSystemFromFiles(Element groups,
Element users)
This method imports groups and user data from XML JDOM trees. |
void |
initializeGroup(MCRGroup group,
String creator)
This method is used by the initialization process of the user/group system to create a starting configuration without checking the consistency of the data. |
void |
initializeUser(MCRUser user,
String creator)
This method is used by the initialization process of the user/group system to create a starting configuration without checking the consistency of the data. |
static MCRUserMgr |
instance()
This method is the only way to get an instance of this class. |
static boolean |
isAuthenticated(MCRUser user)
This method checks if the user is authenticated, i.e. |
boolean |
isLocked()
return This method returns true is if the user manager is in the locked state |
boolean |
login(String userID,
String passwd)
login to the system. |
MCRGroup |
retrieveGroup(String groupID)
This method retrieves the group object with the given group ID. |
protected MCRGroup |
retrieveGroup(String groupID,
boolean bFromDataStore)
This method first looks for a given groupID in the group cache and returns this group object. |
Set<MCRGroup> |
retrieveGroups(Set<String> groupIDs)
In the access control subsystem only IDs are stored, not references to user or group objects. |
MCRUser |
retrieveUser(String userID)
This method first retrieves the user object with the given userID. |
protected MCRUser |
retrieveUser(String userID,
boolean bFromDataStore)
This method first looks for a given userID in the user cache and returns this user object. |
Set<MCRUser> |
retrieveUsers(Set<String> userIDs)
In the access control subsystem only IDs are stored, not references to user or group objects. |
void |
setLock(boolean locked)
This method sets the lock-status of the user manager. |
void |
setPassword(String userID,
String password)
This method sets a new password for the given user. |
void |
updateGroup(MCRGroup updGroup)
This method updates a group in the datastore (and the cache as well). |
void |
updateUser(MCRUser updUser)
This method updates a user in the datastore (and the cache as well). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static final MCRUserMgr instance()
throws MCRException
MCRUserMgr
MCRException
public final void checkConsistency()
throws MCRException
MCRException
public final void createGroup(MCRGroup group)
throws MCRException
group - The group object to be created
MCRException
public final void createUser(MCRUser user)
throws MCRException
user - The user object which will be created
MCRException
public final void deleteGroup(String groupID)
throws MCRException
groupID - The group ID which will be deleted
MCRException
public final void deleteUser(String userID)
throws MCRException
userID - The user ID which will be deleted
MCRException
public final void disableUser(String userID)
throws MCRException
userID - The user object which will be disabled
MCRException
public final void enableUser(String userID)
throws MCRException
userID - The user object which will be enabled
MCRException
public final List<String> getAllGroupIDs()
throws MCRException
MCRException
public final Document getAllGroups()
throws MCRException
MCRException
public final List<String> getAllUserIDs()
throws MCRException
MCRException
public final Document getAllUsers()
throws MCRException
MCRExceptionpublic final MCRUser getCurrentUser()
public final Set<MCRGroup> getGroupsContainingUser(MCRUser user,
Set<MCRGroup> groups)
public final List<String> getGroupsContainingUser(String user)
public final int getMaxUserNumID()
throws MCRException
MCRExceptionpublic final String getPrimaryGroupIDOfUser(String userID)
userID - the userID for which the primary group ID is requested
public final void initializeGroup(MCRGroup group,
String creator)
throws MCRException
group - The group object which should be createdcreator - the creator
MCRException
public final void initializeUser(MCRUser user,
String creator)
throws MCRException
user - The user object which should be createdcreator - The creator
MCRException
public final void importUserSystemFromFiles(Element groups,
Element users)
throws MCRException
groupfile - the JDOM tree of the MCRGroups data inputuserfile - the JDOM tree of the MCRUsers data input
MCRExceptionpublic static final boolean isAuthenticated(MCRUser user)
public final boolean isLocked()
public boolean login(String userID,
String passwd)
throws MCRException
userID - user ID for the loginpasswd - password for the user
MCRException
public MCRGroup retrieveGroup(String groupID)
throws MCRException
groupID - string representing the requested group object
MCRException - if group object is not known
protected MCRGroup retrieveGroup(String groupID,
boolean bFromDataStore)
throws MCRException
groupID - string representing the requested group objectbFromDataStore - boolean value, if true the group must be retrieved directly
from the data store
MCRException - if group object is not known
public final Set<MCRGroup> retrieveGroups(Set<String> groupIDs)
throws MCRException
groupIDs - A set of group IDs for which the group objects are to be
retrieved
MCRException
public MCRUser retrieveUser(String userID)
throws MCRException
userID - string representing the requested user object
MCRException - if user object is not known
protected MCRUser retrieveUser(String userID,
boolean bFromDataStore)
throws MCRException
userID - string representing the requested user objectbFromDataStore - boolean value, if true the user must be retrieved directly
from the data store
MCRException - if user object is not knownpublic final Set<MCRUser> retrieveUsers(Set<String> userIDs)
userIDs - A set of user IDs for which the user objects are to be
retrieved
MCRExceptionpublic final void setLock(boolean locked)
locked - flag that determines whether write access to the data is
denied (true) or allowed
public final void setPassword(String userID,
String password)
throws MCRException
userID - the userIDpassword - the user password
MCRException
public final void updateGroup(MCRGroup updGroup)
throws MCRException
updGroup - The group object which will be updated
MCRException
public final void updateUser(MCRUser updUser)
throws MCRException
updUser - The user object which will be updated
MCRExceptionpublic final boolean existGroup(String group)
group - the group name as String
public final boolean existUser(String user)
user - the user name as String
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||