|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jcorporate.expresso.core.security.User
This class provides a front-end for maintaining Expresso Users. This class provides an abstraction of the minimum information required for a valid User in Expresso. This class is an "Adaptor" that "adapts" the actual class that implements the User object. "Adaptee" user classes must implement the UserInfo interface. In addition, classes that implement the UserListener interface can listen in on when user objects are added, modified or deleted.
interface,
interface,
LookupInterface| Field Summary | |
static String |
ACTIVE_ACCOUNT_STATUS
the string code for an active account |
static String |
ADMIN_USER
the admin user; user id = 3 usually |
static String |
ANONYMOUS_ALLOWED_GUEST_USER
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 |
static String |
DISABLED_ACCOUNT_STATUS
the string code for an disabled account |
static String |
INACTIVE_ACCOUNT_STATUS
the string code for an disabled account |
protected static UserInfo |
notLoggedInUser
|
static String |
UNKNOWN_USER
the unknown user; no login yet; user id = 2 usually |
static String |
WAITING_FOR_APPROVAL_ACCOUNT_STATUS
the string code for an account that is awaiting admin approval after registration |
| Constructor Summary | |
User()
Default constructor |
|
User(UserInfo uInfo)
Constructs a user with a particular user info. |
|
| Method Summary | |
void |
add()
Adds this user to the underlying storage mechanism (SQL-DB, LDAP, etc.) |
static void |
addListener(UserListener listener)
Adds a UserListener object to list of listeners. |
void |
addNotify(UserInfo uif)
Used when a UserInfo Object adds itself outside of the 'User' class. |
boolean |
checkEmailAuthCode(String emailAuthCode)
This method just checks to make sure that the submitted emailAuthCode matches the real code. |
void |
clear()
Uncaches the underlying UserInfo implementation object |
protected UserInfo |
constructNotLoggedInUser()
|
void |
delete()
Calls back registered listeners so they can cleanup and then deletes the user |
void |
deleteNotify(UserInfo uif)
Used for when a UserInfo implementation deletes itself outside of the User Interface |
boolean |
find()
Find a user matching the values of the properties that have been set |
String |
getAccountStatus()
Returns the current status of the account. |
static User |
getAdmin(String dbName)
Retrieves the User instance of the current user. |
static int |
getAdminId()
determine admin id (usually '3') WARNING: assumes dbname = 'default' |
static int |
getAdminId(String dbname)
determine admin id (usually '3') |
Vector |
getAllUsers()
Returns a list of all the Users in the database. |
String |
getDataContext()
Returns the currently set DB context |
String |
getDBName()
Retrieve the data context for this particular object implementation |
String |
getDisplayName()
Returns a descriptiptive, longer name for the user this is NOT THE UNIQUE LOGIN NAME. |
String |
getEmail()
Returns the email address of the user |
String |
getEmailAuthCode()
Here we generate an authorization code that would be hard for someone to guess. |
String |
getEmailValCode()
Returns the code required for authorization via email |
Vector |
getGroups()
Return a vector of the group names that this user belongs to |
List |
getGroupsList()
Return a List of the group names that this user belongs to |
static int |
getIdFromLogin(String login,
String myDBname)
utility |
String |
getKeyValue(String mappedValue)
Given a 'friendly name' get the key value for this object. |
static String |
getLoginFromId(int uid,
String dataContext)
utility |
String |
getLoginName()
Returns the string that the user needs to use to login. |
String |
getMappedDescription()
It returns if the field description for the mapped value as specified by the key value parameter. |
String |
getMappedValue(String keyValue)
Given a key value, return the mapped value. |
UserInfo |
getNotLoggedInUser()
Returns the static constant notLogged in user. |
String |
getPassword()
Returns the password string for the user. |
String |
getPrimaryGroup()
the primary group of this user is appropriate for unix-like purposes, such as setting the group for a file permission |
boolean |
getRegComplete()
Whether registration has been completed beyond the basic user info |
String |
getRegistrationDomain()
Returns the unique integer for the registration domain that this user belongs to |
int |
getUid()
|
String |
getUidString()
Returns the unique integer used as a key to identify the user |
static User |
getUser(ControllerRequest request)
Convenience routine to find current user. |
static User |
getUserFromId(int uid,
String dataContext)
Pull up the User object associated with the integer id |
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. |
Vector |
getValidValues(String fieldName)
Returns the possible values for the multivalued properties |
Vector |
getValues()
Method to return a Vector of ValidValue This method may be implemented by objects that want to provide a list of valid values for other DB objects. |
boolean |
isAdmin()
determine if this user is admin |
static boolean |
isAdmin(int id)
determine if this user is admin WARNING: assumes dbname = 'default' |
static boolean |
isAdmin(String name)
determine if this user is admin |
static boolean |
isListener(UserListener listener)
Determines if this dbobject is already a listener. |
boolean |
isMember(String candidategroupname)
determine whether this user is in this group |
static boolean |
isUnknownUser(String name)
determine if this user is unknown |
void |
notify(String subject,
String message)
Send this user a notification via e-mail. |
void |
notify(String subject,
String message,
boolean htmlFormat)
Notify the user with the optional parameter of using html format |
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. |
boolean |
passwordEquals(String tryPassword)
passwordEquals - feed it a password and it will tell you if the hash of it matches the one on file. |
void |
postLogin()
Called by the various objects that can log in a user to do post-login tasks |
String |
randomPassword()
Generates a random plaintext password |
void |
retrieve()
|
void |
sendAuthEmail()
|
void |
sendFileTo(String subject,
String message,
Vector fileNames)
Send this user an e-mail with file attachments. |
void |
sendFollowUpEmail()
|
void |
setAccountStatus(String accountStatus)
Sets the current status of the account |
void |
setDataContext(String newContext)
Sets the data context for this particular object implementation. |
void |
setDBName(String newDBName)
Switches data contexts for the User Object |
void |
setDisplayName(String name)
Sets a long, descriptive name for the user |
void |
setEmail(String email)
Sets the email address for the user |
void |
setEmailValCode(String code)
Sets the validation code for authorization via email |
void |
setLoginName(String loginName)
Sets the name to be used by this user to login |
void |
setPassword(String password)
Sets the password to be used by the user. |
void |
setRegComplete(boolean status)
Sets the status of whether the extended registration has been completed or not |
void |
setRegistrationDomain(String domain)
Sets the registration domain that this user belongs to |
void |
setUid(int uid)
Sets the uid, used for finding... |
void |
setUid(String uid)
Sets the user id. |
void |
update()
This method is called to update the properties of an User object. |
void |
updateNotify(UserInfo uif)
Used to notify UserListeners that a UserInfo object has modified itself outside of the User object. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static UserInfo notLoggedInUser
public static final String ANONYMOUS_ALLOWED_GUEST_USER
public static final String UNKNOWN_USER
public static final String ADMIN_USER
public static final String ACTIVE_ACCOUNT_STATUS
setAccountStatus(java.lang.String),
Constant Field Valuespublic static final String DISABLED_ACCOUNT_STATUS
setAccountStatus(java.lang.String),
Constant Field Valuespublic static final String INACTIVE_ACCOUNT_STATUS
setAccountStatus(java.lang.String),
Constant Field Valuespublic static final String WAITING_FOR_APPROVAL_ACCOUNT_STATUS
setAccountStatus(java.lang.String),
Constant Field Values| Constructor Detail |
public User()
public User(UserInfo uInfo)
SuperUser for example usage.
uInfo - UserInfo| Method Detail |
public void add()
throws DBException
DBException - If the add fails
public void addNotify(UserInfo uif)
throws DBException
uif - a user info object that has been modified.
DBException - if ther's an error performing the 'add' operationpublic static void addListener(UserListener listener)
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 namefor an example of a listener (it is superclass to several listeners)public static boolean isListener(UserListener listener)
listener - The UserListener class
public boolean checkEmailAuthCode(String emailAuthCode)
throws DBException
emailAuthCode - java.lang.String
DBException - The exception description.
public void clear()
throws DBException
DBException - The exception description.
public void delete()
throws DBException
DBException - If the delete fails
public void deleteNotify(UserInfo uif)
throws DBException
uif - The user info that has been modified.
DBException
public boolean find()
throws DBException
DBException - Thrown if the underlying implementation throws an exception
public String getAccountStatus()
throws DBException
DBException - If the underlying User implementation throws the same
public Vector getAllUsers()
throws DBException
DBException - If the underlying User implementation throws the samepublic String getDataContext()
getDataContext in interface ContextNested
public String getEmail()
throws DBException
DBException - If the underlying User implementation throws the same
public String getEmailAuthCode()
throws DBException
DBException
public String getEmailValCode()
throws DBException
DBException - If the underlying User implementation throws the same
public Vector getGroups()
throws DBException
DBException - If an error occurs when the group info is read
public List getGroupsList()
throws DBException
DBException - If an error occurs when the group info is read
public String getLoginName()
throws DBException
DBException - If the underlying User implementation throws the same
public String getPassword()
throws DBException
DBException - If the underlying User implementation throws the same
public UserInfo getNotLoggedInUser()
throws DBException
DBException
protected UserInfo constructNotLoggedInUser()
throws DBException
DBException
public boolean getRegComplete()
throws DBException
DBException - If the underlying UserInfo implementation throws the same
public String getRegistrationDomain()
throws DBException
DBException - If the underlying User implementation throws the same
public String getUidString()
throws DBException
DBException - If the underlying User implementation throws the same
public int getUid()
throws DBException
DBException
public UserInfo getUserInfo()
throws DBException
DBException - If an error occurs when setting dbname in a newly created UserInfo object
public String getDisplayName()
throws DBException
DBException - If the underlying User implementation throws the samegetLoginName()
public Vector getValidValues(String fieldName)
throws DBException
fieldName - The fieldname to get the valid values for
DBException - The exception description.
public Vector getValues()
throws DBException
LookupInterface
getValues in interface LookupInterfaceDBException
public void notify(String subject,
String message)
throws DBException
subject - Subject of the e-mailmessage - Message to send in body of e-mail
DBException - If the mail message cannot be sent
public void notify(String subject,
String message,
boolean htmlFormat)
throws DBException
subject - the message subjectmessage - the message, possibly in html formathtmlFormat - true if you want the message to be html formatted.
DBException - upon error
public void notify(String subject,
String message,
boolean htmlFormat,
ByteArrayDataSource[] attachments)
throws DBException
subject - the message subjectmessage - the message, possibly in html formathtmlFormat - true if you want the message to be html formatted.attachments - an primitive array of raw data byte array data sources.
DBException - upon error from databaseByteArrayDataSource
public boolean passwordEquals(String tryPassword)
throws DBException
tryPassword - The value the user input for an attempted login.
DBException
public void postLogin()
throws DBException,
LogException
DBException
LogExceptionpublic String randomPassword()
public void retrieve()
throws DBException
DBException - The exception description.
public void sendAuthEmail()
throws DBException
DBException
public void sendFileTo(String subject,
String message,
Vector fileNames)
throws DBException,
LogException
subject - Subject of the e-mailmessage - Message to send in body of e-mailfileNames - of the files to attach
DBException - If the mail message cannot be sent
LogException
public void sendFollowUpEmail()
throws DBException
DBException
public void setAccountStatus(String accountStatus)
throws DBException
accountStatus - java.lang.String One of the values "A" (active), "I" (inactive), "D" (disabled)
DBException - If the underlying UserInfo implementation throws the same
public void setDBName(String newDBName)
throws DBException
newDBName - The new data context to use this security object for
DBException - The exception description.
public void setEmail(String email)
throws DBException
email - the new email address of this user
DBException - If the underlying User implementation throws the same
public void setEmailValCode(String code)
throws DBException
code - the new validation code
DBException
public void setLoginName(String loginName)
throws DBException
loginName - the new login name for this user object
DBException - If the underlying User implementation throws the same
public void setPassword(String password)
throws DBException
password - the new password to set for this user
DBException - If the underlying User implementation throws the same
public void setRegComplete(boolean status)
throws DBException
status - java.lang.String Valid values are "Y" or "N"
DBException - If the underlying UserInfo implementation throws the same
public void setRegistrationDomain(String domain)
throws DBException
domain - The registration domain that this user belongs to.
DBException - If the underlying User implementation throws the same
public void setUid(int uid)
throws DBException
uid - The new UID integer to set this user object to.
DBException - If the underlying User implementation throws the same
public void setUid(String uid)
throws DBException
uid - a string containing an integer value
DBException - upon parse error
public void setDisplayName(String name)
throws DBException
name - the new 'full name' of the user
DBException - If the underlying User implementation throws the same
public void update()
throws DBException
DBException - The exception description.
public void updateNotify(UserInfo uif)
throws DBException
uif - The new user info to update
DBException
public boolean isAdmin()
throws DBException
DBException
public static boolean isAdmin(int id)
throws DBException
id - of user
DBException - upon error
public static int getAdminId()
throws DBException
DBException - upon error
public static User getAdmin(String dbName)
throws DBException
dbName - String the data context to check.
DBException - if there was no admin user found or
other database errors.
public static int getAdminId(String dbname)
throws DBException
dbname - the Database context to use
DBException - upon errorpublic static boolean isAdmin(String name)
name - the login name to test
public static boolean isUnknownUser(String name)
name - the login name of the user
public String getPrimaryGroup()
throws DBException
DBException - upon database access error
public static int getIdFromLogin(String login,
String myDBname)
throws DBException
login - the login namemyDBname - the DataContext to use.
DBException - upon databaes access error or if the uid cannot be found.
public static User getUserFromId(int uid,
String dataContext)
throws DBException
uid - the integer user iddataContext - data context to look in.
DBException - if the user is unable to be found.
public static String getLoginFromId(int uid,
String dataContext)
throws DBException
uid - the uid of the userdataContext - the data context to use
DBException - upon database access error or if the given id cannot be found.public String getKeyValue(String mappedValue)
getKeyValue in interface MappablemappedValue - the value to convert to a key field. It will return null
if the mapped value does not exist.
public String getMappedValue(String keyValue)
getMappedValue in interface MappablekeyValue - the key value to map
public String getMappedDescription()
Total Hack warning: This function assumes you're running a DataObject with the login name field called: LoginName
getMappedDescription in interface Mappablepublic void setDataContext(String newContext)
setDataContext in interface ContextNestednewContext - the new Data context.
IllegalArgumentException - if the data context is null.public String getDBName()
public static User getUser(ControllerRequest request)
throws DBException
request - current request
DBException - upon database access error
public boolean isMember(String candidategroupname)
throws DBException
candidategroupname - the name to check against.
DBException - upon database access error
|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||