Class UserManager
java.lang.Object
org.dlese.dpc.schemedit.security.user.UserManager
Manages
User instances and provides information about users
inlcuding roles, attributes, preferences, etc.Reads user data from disk as XML Files, provides run-time services to suport UI, and authentication
- Author:
- Jonathan Ostwald
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateUser(String username) Create a new User instance for provided user name.voiddeleteUser(String username) Remove user associated with provided username from registryvoiddestroy()Destroy this Usermanager and all the managed users.voidflush()Write user data to disk.Gets the User instance having supplied username, or null if user cannot be found.Return a listing of users including username and fullNames.getUsers()Returns a list of all user instances managed by this UserManager.getUsers(Roles.Role maxRole) Returns all users having role equal to or below maxRole.voidload()Reads the data dir, constructs user instances, and registers themstatic voidThe main program for the UserManager classprotected static voidNOT YET DOCUMENTEDvoidAdds provided User instance to the managed users.voidWrites data for specified user to disk as XML filestatic voidsetDebug(boolean bool) voidDebugging method to print string representation of all managed usersvoidunregister(User user) Removes provided user from the managed users.
-
Constructor Details
-
UserManager
Constructor for the UserManager object- Parameters:
userDataDir- directory containing XML files of user data- Throws:
Exception- if the directory cannot be processed
-
-
Method Details
-
load
public void load()Reads the data dir, constructs user instances, and registers them -
getUser
Gets the User instance having supplied username, or null if user cannot be found.- Parameters:
username- the username- Returns:
- The user value
-
createUser
Create a new User instance for provided user name.- Parameters:
username- the username- Returns:
- a User instance
- Throws:
Exception- if user for provided username exists.
-
deleteUser
Remove user associated with provided username from registry- Parameters:
username- username of user to delete
-
saveUser
Writes data for specified user to disk as XML file- Parameters:
user- user to be saved- Throws:
Exception- if provided user does not have a username
-
getUsers
Returns a list of all user instances managed by this UserManager.- Returns:
- The users value
-
getUsers
Returns all users having role equal to or below maxRole.- Parameters:
maxRole- NOT YET DOCUMENTED- Returns:
- The users value
-
register
Adds provided User instance to the managed users.- Parameters:
user- The feature to be added to the User attribute
-
unregister
Removes provided user from the managed users.- Parameters:
user- User to unregister
-
flush
Write user data to disk.First creates Document containing all user data, then reinitializes docMap with the Document so it will be written to disk.
- Throws:
Exception- NOT YET DOCUMENTED
-
main
The main program for the UserManager class- Parameters:
args- The command line arguments- Throws:
Exception- NOT YET DOCUMENTED
-
getUserDisplayNames
Return a listing of users including username and fullNames.- Returns:
- The userDisplayNames value
-
showUsers
public void showUsers()Debugging method to print string representation of all managed users -
destroy
public void destroy()Destroy this Usermanager and all the managed users. -
setDebug
public static void setDebug(boolean bool) -
prtln
NOT YET DOCUMENTED- Parameters:
s- NOT YET DOCUMENTED
-