| |
|
| java.lang.Object com.jcorporate.expresso.core.security.User
All known Subclasses: com.jcorporate.expresso.core.security.SuperUser,
Constructor Summary | |
public | User() | public | User(UserInfo uInfo) Constructs a user with a particular user info. |
Method Summary | |
public void | add() | public static synchronized void | addListener(UserListener listener) Adds a UserListener object to list of listeners.
The listener param is passed in as an instance, but this is a STATIC LISTENER scheme.
In other words, one instance is not listening to another instance. | public void | addNotify(UserInfo uif) Used when a UserInfo Object adds itself outside of the 'User' class. | public boolean | checkEmailAuthCode(String emailAuthCode) This method just checks to make sure that the submitted emailAuthCode
matches the real code. | public synchronized void | clear() | protected UserInfo | constructNotLoggedInUser() | public void | delete() | public void | deleteNotify(UserInfo uif) | public boolean | find() | public String | getAccountStatus() Returns the current status of the account. | public static User | getAdmin(String dbName) Retrieves the User instance of the current user.
Parameters: dbName - String the data context to check. | public static int | getAdminId() | public static int | getAdminId(String dbname) | public Vector | getAllUsers() Returns a list of all the Users in the database. | public String | getDBName() Retrieve the data context for this particular object implementation
java.lang.String. | public String | getDataContext() | public String | getDisplayName() Returns a descriptiptive, longer name for the user
this is NOT THE UNIQUE LOGIN NAME. | public String | getEmail() | public String | getEmailAuthCode() Here we generate an authorization code that would be hard for someone to
guess. | public String | getEmailValCode() | public Vector | getGroups() | public List | getGroupsList() | public static int | getIdFromLogin(String login, String myDBname) utility
Parameters: login - the login name Parameters: myDBname - the DataContext to use. | public String | getKeyValue(String mappedValue) Given a 'friendly name' get the key value for this object. | public static String | getLoginFromId(int uid, String dataContext) | public String | getLoginName() Returns the string that the user needs to use to login. | public String | getMappedDescription() It returns if the field description for the mapped value as specified by the
key value parameter. | public String | getMappedValue(String keyValue) Given a key value, return the mapped value. | public synchronized UserInfo | getNotLoggedInUser() Returns the static constant notLogged in user. | public String | getPassword() Returns the password string for the user. | public String | getPrimaryGroup() | public boolean | getRegComplete() | public String | getRegistrationDomain() | public int | getUid() | public String | getUidString() | public static User | getUser(ControllerRequest request) Convenience routine to find current user. | public static User | getUserFromId(int uid, String dataContext) Pull up the User object associated with the integer id
Parameters: uid - the integer user id Parameters: dataContext - data context to look in. | public UserInfo | getUserInfo() Return the UserInfo object Normally you would not use this directly, except
in special cases where you need to get to the UserInfo object. | public synchronized Vector | getValidValues(String fieldName) | public Vector | getValues() | public boolean | isAdmin() | public static boolean | isAdmin(int id) | public static boolean | isAdmin(String name) | public static synchronized boolean | isListener(UserListener listener) Determines if this dbobject is already a listener. | public boolean | isMember(String candidategroupname) determine whether this user is in this group
Parameters: candidategroupname - the name to check against. | public static boolean | isUnknownUser(String name) | public void | notify(String subject, String message) Send this user a notification via e-mail. | public void | notify(String subject, String message, boolean htmlFormat) | public void | notify(String subject, String message, boolean htmlFormat, ByteArrayDataSource attachments) Notify the user with the optional parameter of using html
format with virtual raw data attachments. | public boolean | passwordEquals(String tryPassword) passwordEquals - feed it a password and it will tell you if the hash of it
matches the one on file.
Parameters: tryPassword - The value the user input for an attempted login. | public void | postLogin() | public String | randomPassword() | public void | retrieve() | public void | sendAuthEmail() | public void | sendFileTo(String subject, String message, Vector fileNames) Send this user an e-mail with file attachments. | public void | sendFollowUpEmail() | public void | setAccountStatus(String accountStatus) | public synchronized void | setDBName(String newDBName) | public void | setDataContext(String newContext) Sets the data context for this particular object implementation. | public void | setDisplayName(String name) | public void | setEmail(String email) | public void | setEmailValCode(String code) | public void | setLoginName(String loginName) | public void | setPassword(String password) Sets the password to be used by the user. | public void | setRegComplete(boolean status) | public void | setRegistrationDomain(String domain) | public void | setUid(int uid) Sets the uid, used for finding... | public void | setUid(String uid) Sets the user id. | public void | update() This method is called to update the properties of an User object. | public void | updateNotify(UserInfo uif) Used to notify UserListeners that a UserInfo object has modified
itself outside of the User object. |
ADMIN_USER | final public static String ADMIN_USER(Code) | | the admin user; user id = 3 usually
|
ANONYMOUS_ALLOWED_GUEST_USER | final public static String ANONYMOUS_ALLOWED_GUEST_USER(Code) | | the anonymous user; used in systems where anonymous guest
are allowed; different than UNKNOWN because there is some kind
of status/login conferred by system; user id = 1 usually
|
UNKNOWN_USER | final public static String UNKNOWN_USER(Code) | | the unknown user; no login yet; user id = 2 usually
|
WAITING_FOR_APPROVAL_ACCOUNT_STATUS | final public static String WAITING_FOR_APPROVAL_ACCOUNT_STATUS(Code) | | the string code for an account that is awaiting admin approval after registration
See Also: User.setAccountStatus |
User | public User()(Code) | | Default constructor
|
add | public void add() throws DBException(Code) | | Adds this user to the underlying storage mechanism (SQL-DB, LDAP, etc.)
throws: DBException - If the add fails |
addListener | public static synchronized void addListener(UserListener listener)(Code) | | Adds a UserListener object to list of listeners.
The listener param is passed in as an instance, but this is a STATIC LISTENER scheme.
In other words, one instance is not listening to another instance. The *classes*
are listening to one another. It is generally used as a kind of a poor substitute for 'detail' records,
which are deleted in a cascading manner. So when the User object is add/modified/deleted, it will
call the method on the provided instance, which usually causes a search and manipulation of
all records having to do with the user--not that each record has been registered as listening.
Parameters: listener - UserListener The object whose object TYPE wants to listen in on User add/modify/delete; we will keep this instance for listening, but any other object of this type cannot register for listening--it is just a representative instance, and the hash is on class name See Also: com.jcorporate.expresso.services.dbobj.RegistrationDBObject See Also: for an example of a listener (it is superclass to several listeners) |
addNotify | public void addNotify(UserInfo uif) throws DBException(Code) | | Used when a UserInfo Object adds itself outside of the 'User' class.
Parameters: uif - a user info object that has been modified. throws: DBException - if ther's an error performing the 'add' operation |
checkEmailAuthCode | public boolean checkEmailAuthCode(String emailAuthCode) throws DBException(Code) | | This method just checks to make sure that the submitted emailAuthCode
matches the real code.
Creation date: (8/8/00 3:08:49 PM)
author: Adam Rossi, PlatinumSolutions, Inc.
Parameters: emailAuthCode - java.lang.String boolean throws: com.jcorporate.expresso.core.db.DBException - The exception description. |
delete | public void delete() throws DBException(Code) | | Calls back registered listeners so they can cleanup
and then deletes the user
throws: DBException - If the delete fails |
deleteNotify | public void deleteNotify(UserInfo uif) throws DBException(Code) | | Used for when a UserInfo implementation deletes itself outside of the
User Interface
Parameters: uif - The user info that has been modified. |
find | public boolean find() throws DBException(Code) | | Find a user matching the values of the properties that have been set
true if user is found throws: DBException - Thrown if the underlying implementation throws an exception |
getAccountStatus | public String getAccountStatus() throws DBException(Code) | | Returns the current status of the account. Possible states are
active, disabled, inactive.
java.lang.String throws: DBException - If the underlying User implementation throws the same |
getAdmin | public static User getAdmin(String dbName) throws DBException(Code) | | Retrieves the User instance of the current user.
Parameters: dbName - String the data context to check. User a User instance. throws: DBException - if there was no admin user found orother database errors. |
getAdminId | public static int getAdminId() throws DBException(Code) | | determine admin id (usually '3')
WARNING: assumes dbname = 'default'
the uid of user "Admin" throws: DBException - upon error |
getAdminId | public static int getAdminId(String dbname) throws DBException(Code) | | determine admin id (usually '3')
Parameters: dbname - the Database context to use the id of the admin throws: DBException - upon error |
getAllUsers | public Vector getAllUsers() throws DBException(Code) | | Returns a list of all the Users in the database. The returned Vector contains
UserInfo objects.
java.util.Vector throws: DBException - If the underlying User implementation throws the same |
getDBName | public String getDBName()(Code) | | Retrieve the data context for this particular object implementation
java.lang.String. Should never be null. |
getDataContext | public String getDataContext()(Code) | | Returns the currently set DB context
java.util.String |
getDisplayName | public String getDisplayName() throws DBException(Code) | | Returns a descriptiptive, longer name for the user
this is NOT THE UNIQUE LOGIN NAME.
java.lang.String throws: DBException - If the underlying User implementation throws the same See Also: User.getLoginName() |
getEmailAuthCode | public String getEmailAuthCode() throws DBException(Code) | | Here we generate an authorization code that would be hard for someone to
guess. The idea is that the person has to check the email sent to them to
get this number, and then click on the specially encoded URL to ensure
that he/she actually is checking the email account used at registration.
The little trick of getting the time in milliseconds that the person
registered, multiplying by some constant, and then rounding, is extremely
weak. We need a better method of generating a unique code that will
"play nice" in a query string.
Creation date: (8/8/00 3:00:41 PM)
author: Adam Rossi, PlatinumSolutions, Inc.
java.lang.String |
getEmailValCode | public String getEmailValCode() throws DBException(Code) | | Returns the code required for authorization via email
java.lang.String throws: DBException - If the underlying User implementation throws the same |
getGroups | public Vector getGroups() throws DBException(Code) | | Return a vector of the group names that this user belongs to
Vector Group names that this user belongs to throws: DBException - If an error occurs when the group info is read |
getGroupsList | public List getGroupsList() throws DBException(Code) | | Return a List of the group names that this user belongs to
Vector Group names that this user belongs to throws: DBException - If an error occurs when the group info is read |
getIdFromLogin | public static int getIdFromLogin(String login, String myDBname) throws DBException(Code) | | utility
Parameters: login - the login name Parameters: myDBname - the DataContext to use. the integer uid of the given login throws: DBException - upon databaes access error or if the uid cannot be found. |
getKeyValue | public String getKeyValue(String mappedValue)(Code) | | Given a 'friendly name' get the key value for this object. Example, mappedValue
= "Admin", then getKeyValue("Admin") will return "3"
Parameters: mappedValue - the value to convert to a key field. It will return nullif the mapped value does not exist. java.lang.String or null. |
getLoginFromId | public static String getLoginFromId(int uid, String dataContext) throws DBException(Code) | | utility
Parameters: uid - the uid of the user Parameters: dataContext - the data context to use the Login for the given UID throws: DBException - upon database access error or if the given id cannot be found. |
getLoginName | public String getLoginName() throws DBException(Code) | | Returns the string that the user needs to use to login.
java.lang.String throws: DBException - If the underlying User implementation throws the same |
getMappedDescription | public String getMappedDescription()(Code) | | It returns if the field description for the mapped value as specified by the
key value parameter.
Total Hack warning: This function assumes you're running a DataObject
with the login name field called: LoginName
String the mapped description |
getMappedValue | public String getMappedValue(String keyValue)(Code) | | Given a key value, return the mapped value. So for example:
getMappedValue("3") will return "Admin"
Parameters: keyValue - the key value to map the mapped value. It will return null if the key does notexist |
getNotLoggedInUser | public synchronized UserInfo getNotLoggedInUser() throws DBException(Code) | | Returns the static constant notLogged in user.
An instantiated UserInfo object |
getPassword | public String getPassword() throws DBException(Code) | | Returns the password string for the user. NOTE: The user class itself has no idea whether the
password was encoded or not, that will be upto the implementation of whatever
servlet/controller that sets the password in the first place. Conversely, the servlet/controller
that logs the user in must know whether the password that this method retrieves was encoded or
not.
java.lang.String throws: DBException - If the underlying User implementation throws the same |
getPrimaryGroup | public String getPrimaryGroup() throws DBException(Code) | | the primary group of this user is appropriate for unix-like purposes,
such as setting the group for a file permission
name of the primary group of this user; null if no group is primary throws: DBException - upon database access error |
getRegComplete | public boolean getRegComplete() throws DBException(Code) | | Whether registration has been completed beyond the basic user info
java.lang.String throws: DBException - If the underlying UserInfo implementation throws the same |
getUserFromId | public static User getUserFromId(int uid, String dataContext) throws DBException(Code) | | Pull up the User object associated with the integer id
Parameters: uid - the integer user id Parameters: dataContext - data context to look in. a built User object throws: DBException - if the user is unable to be found. |
getUserInfo | public UserInfo getUserInfo() throws DBException(Code) | | Return the UserInfo object Normally you would not use this directly, except
in special cases where you need to get to the UserInfo object.
the UserInfo object throws: DBException - If an error occurs when setting dbname in a newly created UserInfo object |
getValidValues | public synchronized Vector getValidValues(String fieldName) throws DBException(Code) | | Returns the possible values for the multivalued properties
Parameters: fieldName - The fieldname to get the valid values for java.util.Vector throws: DBException - The exception description. |
isAdmin | public boolean isAdmin() throws DBException(Code) | | determine if this user is admin
true if this user is the Administrator account |
isAdmin | public static boolean isAdmin(int id) throws DBException(Code) | | determine if this user is admin
WARNING: assumes dbname = 'default'
Parameters: id - of user true if the id is an Admin user. throws: DBException - upon error |
isAdmin | public static boolean isAdmin(String name)(Code) | | determine if this user is admin
Parameters: name - the login name to test true if the name is the Admin user. |
isListener | public static synchronized boolean isListener(UserListener listener)(Code) | | Determines if this dbobject is already a listener.
Parameters: listener - The UserListener class boolean true if the class is already registered as a listener |
isMember | public boolean isMember(String candidategroupname) throws DBException(Code) | | determine whether this user is in this group
Parameters: candidategroupname - the name to check against. true if the provided group name is one of the groups that this user is a member of throws: DBException - upon database access error |
isUnknownUser | public static boolean isUnknownUser(String name)(Code) | | determine if this user is unknown
Parameters: name - the login name of the user true if the name is UNKNOWN_USER ("NONE") |
notify | public void notify(String subject, String message) throws DBException(Code) | | Send this user a notification via e-mail.
Parameters: subject - Subject of the e-mail Parameters: message - Message to send in body of e-mail throws: DBException - If the mail message cannot be sent |
notify | public void notify(String subject, String message, boolean htmlFormat) throws DBException(Code) | | Notify the user with the optional parameter of using html format
Parameters: subject - the message subject Parameters: message - the message, possibly in html format Parameters: htmlFormat - true if you want the message to be html formatted. throws: DBException - upon error |
notify | public void notify(String subject, String message, boolean htmlFormat, ByteArrayDataSource attachments) throws DBException(Code) | | Notify the user with the optional parameter of using html
format with virtual raw data attachments.
Parameters: subject - the message subject Parameters: message - the message, possibly in html format Parameters: htmlFormat - true if you want the message to be html formatted. Parameters: attachments - an primitive array of raw data byte array data sources. throws: DBException - upon error from database See Also: com.jcorporate.expresso.core.misc.ByteArrayDataSource |
passwordEquals | public boolean passwordEquals(String tryPassword) throws DBException(Code) | | passwordEquals - feed it a password and it will tell you if the hash of it
matches the one on file.
Parameters: tryPassword - The value the user input for an attempted login. boolean |
postLogin | public void postLogin() throws DBException, LogException(Code) | | Called by the various objects that can log in a user
to do post-login tasks
|
randomPassword | public String randomPassword()(Code) | | Generates a random plaintext password
java.lang.String |
sendFileTo | public void sendFileTo(String subject, String message, Vector fileNames) throws DBException, LogException(Code) | | Send this user an e-mail with file attachments.
Parameters: subject - Subject of the e-mail Parameters: message - Message to send in body of e-mail Parameters: fileNames - of the files to attach throws: DBException - If the mail message cannot be sent |
setAccountStatus | public void setAccountStatus(String accountStatus) throws DBException(Code) | | Sets the current status of the account
Parameters: accountStatus - java.lang.String One of the values "A" (active), "I" (inactive), "D" (disabled) throws: DBException - If the underlying UserInfo implementation throws the same |
setDataContext | public void setDataContext(String newContext)(Code) | | Sets the data context for this particular object implementation.
Parameters: newContext - the new Data context. throws: IllegalArgumentException - if the data context is null. |
setEmailValCode | public void setEmailValCode(String code) throws DBException(Code) | | Sets the validation code for authorization via email
Parameters: code - the new validation code |
setRegComplete | public void setRegComplete(boolean status) throws DBException(Code) | | Sets the status of whether the extended registration has been completed or not
Parameters: status - java.lang.String Valid values are "Y" or "N" throws: DBException - If the underlying UserInfo implementation throws the same |
setUid | public void setUid(String uid) throws DBException(Code) | | Sets the user id. Parsing the string to an integer
Parameters: uid - a string containing an integer value throws: DBException - upon parse error |
update | public void update() throws DBException(Code) | | This method is called to update the properties of an User object.
All changed and unchanged fields must have their values filled in
The best way is to do a find() on the User first, and then to set
the modified fields before calling this method.
throws: com.jcorporate.expresso.core.db.DBException - The exception description. |
updateNotify | public void updateNotify(UserInfo uif) throws DBException(Code) | | Used to notify UserListeners that a UserInfo object has modified
itself outside of the User object.
Parameters: uif - The new user info to update |
|
|
|