org.liquidsite.app.template
Class UserBean

java.lang.Object
  extended byorg.liquidsite.app.template.UserBean

public class UserBean
extends java.lang.Object

A user template bean. This class is used to insert the user object in the into the template data model.


Method Summary
 boolean getDomainadmin()
          Checks if the users has administration privileges in the domain.
 java.lang.String getEmail()
          Returns the user email address.
 java.util.ArrayList getGroups()
          Returns a list of the group names to which the user belong.
 java.lang.String getLogin()
          Returns the user login name.
 java.lang.String getRealName()
          Returns the real user name.
 boolean getSuperuser()
          Returns the superuser flag for the user.
 void groupAdd(java.lang.String name)
          Adds this user to the specified group.
 void groupRemove(java.lang.String name)
          Removes this user to the specified group.
 boolean inGroup(java.lang.String name)
          Checks if the user is member of a named group.
 boolean save()
          Saves all the modifications for this user to the database.
 boolean sendEmailVerification(java.lang.String subject, java.lang.String text, java.lang.String replaceText)
          Sends an email verification request to the user.
 void setEmail(java.lang.String email)
          Sets the user e-mail address.
 void setLogin(java.lang.String login)
          Sets the login user name.
 void setPassword(java.lang.String password)
          Sets the user password.
 void setRealName(java.lang.String realName)
          Sets the real user name.
 java.lang.String toString()
          Returns a description of this user.
 boolean verifyEmail(java.lang.String key)
          Verifies the user email address and unlocks this user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

toString

public java.lang.String toString()
Returns a description of this user. The description will contain the real user name and the login name.

Returns:
a description of this user, or an empty string if the user doesn't exist

getLogin

public java.lang.String getLogin()
Returns the user login name.

Returns:
the user login name, or an empty string if the user doesn't exist

setLogin

public void setLogin(java.lang.String login)
Sets the login user name. This action will not take effect until this object is saved. Note that login names of existing users cannot be modified.

Parameters:
login - the new use login name

setPassword

public void setPassword(java.lang.String password)
Sets the user password. This action will not take effect until this object is saved.

Parameters:
password - the new user password

getRealName

public java.lang.String getRealName()
Returns the real user name.

Returns:
the real user name, or an empty string if the user doesn't exist

setRealName

public void setRealName(java.lang.String realName)
Sets the real user name. This action will not take effect until this object is saved.

Parameters:
realName - the new real user name

getEmail

public java.lang.String getEmail()
Returns the user email address.

Returns:
the user email address, or an empty string if the user doesn't exist

setEmail

public void setEmail(java.lang.String email)
Sets the user e-mail address. This action will not take effect until this object is saved.

Parameters:
email - the new user e-mail address

getDomainadmin

public boolean getDomainadmin()
Checks if the users has administration privileges in the domain. For superusers, this method will always return true.

Returns:
true if the user is a domain admin, or false otherwise

getSuperuser

public boolean getSuperuser()
Returns the superuser flag for the user.

Returns:
true if the user is a superuser, or false otherwise

getGroups

public java.util.ArrayList getGroups()
Returns a list of the group names to which the user belong.

Returns:
a list of group names

inGroup

public boolean inGroup(java.lang.String name)
Checks if the user is member of a named group.

Parameters:
name - the group name
Returns:
true if the user is a member of the group, or false otherwise

groupAdd

public void groupAdd(java.lang.String name)
Adds this user to the specified group. The user will only be added if the group exists and is public. Furthermore, this action will not take effect until this object is saved.

Parameters:
name - the group name

groupRemove

public void groupRemove(java.lang.String name)
Removes this user to the specified group. The user will only be removed if the group exists and is public. Furthermore, this action will not take effect until this object is saved.

Parameters:
name - the group name

save

public boolean save()
Saves all the modifications for this user to the database.

Returns:
true if the user could be saved, or false otherwise

sendEmailVerification

public boolean sendEmailVerification(java.lang.String subject,
                                     java.lang.String text,
                                     java.lang.String replaceText)
Sends an email verification request to the user. The request email will only be sent if the user exists, has an email address set and has not been modified. A verfication key will be inserted into the email subject and text where a specified replacement text matches. This allows for customizing the verification email while only sending the secret validation key in the email.

Parameters:
subject - the mail subject
text - the mail text
replaceText - the key replacement text
Returns:
true if the email verification was sent, or false otherwise
See Also:
verifyEmail(String)

verifyEmail

public boolean verifyEmail(java.lang.String key)
Verifies the user email address and unlocks this user. The verification is done by comparing a previously sent key with the specified one. If the two keys match, the user email is considered verified and this user object is unlocked for save operations by an anonymous user.

Parameters:
key - the verification key
Returns:
true if the verification was correct, or false otherwise