|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.opencms.file.CmsUser
public class CmsUser
A user in the OpenCms permission system.
A user in OpenCms is uniquely definded by its user named returned by
.getName()
Basic users in OpenCms are of type .
This means that the user can access the OpenCms Workplace.
Moreover, the user must be created by another user with the
USER_TYPE_SYSTEMUSER.
This user type is for "content managers" that actually have write permissions in
at last some parts of the VFS.CmsRole.ACCOUNT_MANAGER
Another possible type of users is .
These users do not have access to the OpenCms Workplace.
However, a web user can be created by every user, for example the "Guest" user.
The main use case is that web users are used for users of the website that
can generate their own accounts, in a "please register your account..." scenario.
These web user accounts can then be used to
build personalized web sites. A web user is created using
USER_TYPE_WEBUSER.CmsObject.addWebUser(String, String, String, String, Map)
CmsGroup| Field Summary | |
|---|---|
static int |
USER_TYPE_SYSTEMUSER
A user-type system user. |
static int |
USER_TYPE_WEBUSER
A user-type web user. |
| Fields inherited from interface org.opencms.security.I_CmsPrincipal |
|---|
FLAG_CORE_LIMIT, FLAG_DISABLED, FLAG_ENABLED, FLAG_GROUP_PROJECT_MANAGER, FLAG_GROUP_PROJECT_USER, FLAG_GROUP_WORKFLOW_ROLE, PRINCIPAL_GROUP, PRINCIPAL_USER |
| Constructor Summary | |
|---|---|
CmsUser()
Creates a new empty CmsUser object. |
|
CmsUser(CmsUUID id,
String name,
String description)
Creates a new Cms user object. |
|
CmsUser(CmsUUID id,
String name,
String password,
String description,
String firstname,
String lastname,
String email,
long lastlogin,
int flags,
Map additionalInfo,
String address,
int type)
Creates a new CmsUser object. |
|
| Method Summary | |
|---|---|
static void |
checkEmail(String email)
Validates an email address. |
static void |
checkLogin(String login)
Validates a login. |
static void |
checkZipCode(String zipcode)
Validates a zip code. |
Object |
clone()
Returns a clone of this Objects instance. |
void |
deleteAdditionalInfo(String key)
Delete additional information about the user. |
boolean |
equals(Object obj)
Compares the given object with this principal. |
static List |
filterCore(List users)
Filters out all users with flags greater than . |
static List |
filterCoreFlag(List users,
int flag)
Filters out all users that does not have the given flag set, but leaving all users with flags less than . |
static List |
filterFlag(List users,
int flag)
Filters out all users that does not have the given flag set. |
Map |
getAdditionalInfo()
Returns the complete Hashtable with additional information about the user. |
Object |
getAdditionalInfo(String key)
Returns additional information about the user which are usually set in the users preferences. |
String |
getAddress()
Gets the address. |
String |
getCity()
Returns the city of the address of the user. |
String |
getCountry()
Returns the country of the address of the user. |
String |
getDescription()
Gets the description of this user. |
boolean |
getDisabled()
Decides if this user is disabled. |
String |
getEmail()
Returns the email address of this user. |
String |
getFirstname()
Returns the firstname of this user. |
int |
getFlags()
Returns the flags of this user. |
String |
getFullName()
Returns the "full" name this user in the format "{firstname} {lastname} ({username})". |
static String |
getFullName(CmsUser user)
Returns the "full" name the given user in the format "{firstname} {lastname} ({username})", or the empty String "" if the user is null. |
CmsUUID |
getId()
Returns the id of this user. |
long |
getLastlogin()
Returns the time of the last login of this user. |
String |
getLastname()
Returns the lastname of this user. |
String |
getName()
Gets the (login) name of this user. |
String |
getPassword()
Returns the encrypted user password. |
int |
getType()
Returns the type of the user. |
String |
getZipcode()
Returns the zip code of the address of the user. |
int |
hashCode()
Returns the hash code of this object. |
boolean |
isEnabled()
Returns the enabled flag. |
boolean |
isGuestUser()
Returns true if this user is the default guest user. |
boolean |
isSystemUser()
Returns true if this user is a system user. |
static boolean |
isSystemUser(int type)
Returns true if the provided user type indicates a system user type. |
boolean |
isTouched()
Returns true if this user was touched, e.g. |
boolean |
isWebUser()
Returns true if this user is a web user. |
static boolean |
isWebUser(int type)
Returns true if the provided user type indicates a web user type. |
void |
setAdditionalInfo(Map additionalInfo)
Sets the complete Hashtable with additional information about the user. |
void |
setAdditionalInfo(String key,
Object obj)
Sets additional information about the user. |
void |
setAddress(String value)
Sets the address. |
void |
setCity(String city)
Sets the city of the address of the user. |
void |
setCountry(String country)
Sets the country of the address of the user. |
void |
setDescription(String value)
Sets the description of this user. |
void |
setDisabled()
Disables the user flags by setting them to FLAG_DISABLED. |
void |
setEmail(String value)
Sets the email. |
void |
setEnabled()
Enables the user flags by setting them to FLAG_ENABLED. |
void |
setEnabled(boolean enabled)
Sets the enabled flag. |
void |
setFirstname(String firstname)
Sets the firstname. |
void |
setFlags(int value)
Sets the flags. |
void |
setLastlogin(long value)
Sets the lastlogin. |
void |
setLastname(String lastname)
Gets the lastname. |
void |
setName(String name)
Sets the name (login). |
void |
setPassword(String value)
Sets the password. |
void |
setZipcode(String zipcode)
Sets the zip code of the address of the user. |
String |
toString()
|
void |
touch()
Sets the "touched" status of this user to "true". |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int USER_TYPE_SYSTEMUSER
public static final int USER_TYPE_WEBUSER
| Constructor Detail |
|---|
public CmsUser()
Only intented to be used with the org.opencms.workplace.tools.users.CmsEditUserDialog.
public CmsUser(CmsUUID id,
String name,
String description)
id - the id of the new username - the name of the new userdescription - the description of the new user
public CmsUser(CmsUUID id,
String name,
String password,
String description,
String firstname,
String lastname,
String email,
long lastlogin,
int flags,
Map additionalInfo,
String address,
int type)
id - the id of the new username - the name of the new userpassword - the password of the userdescription - the description of the new userfirstname - the first namelastname - the last nameemail - the email addresslastlogin - time stampflags - flagsadditionalInfo - user related informationaddress - the addresstype - the type of this user| Method Detail |
|---|
public static void checkEmail(String email)
That means, the parameter should only be composed by digits and standard english letters, points, underscores and exact one "At" symbol.
email - the email to validatepublic static void checkLogin(String login)
That means, the parameter should only be composed by digits and standard english letters, points, minus and underscores.
login - the login to validatepublic static void checkZipCode(String zipcode)
That means, the parameter should only be composed by digits and standard english letters.
zipcode - the zipcode to validatepublic static String getFullName(CmsUser user)
user - the user to get the full name from
getFullName()public static boolean isSystemUser(int type)
true if the provided user type indicates a system user type.
type - the user type
public static boolean isWebUser(int type)
true if the provided user type indicates a web user type.
type - the user type
public Object clone()
clone in class Objectpublic void deleteAdditionalInfo(String key)
Additional infos are for example emailadress, adress or surname...
key - The key of the additional information to deletepublic boolean equals(Object obj)
I_CmsPrincipal
equals in interface I_CmsPrincipalequals in class Objectobj - object to comapre
Object.equals(java.lang.Object)public Map getAdditionalInfo()
Additional infos are for example emailadress, adress or surname... The additional infos must be requested via the CmsObject.
public Object getAdditionalInfo(String key)
key - the key to the additional information
nullpublic String getAddress()
public String getCity()
public String getCountry()
public String getDescription()
public boolean getDisabled()
public String getEmail()
public String getFirstname()
public int getFlags()
public String getFullName()
public CmsUUID getId()
getId in interface I_CmsPrincipalpublic long getLastlogin()
public String getLastname()
public String getName()
getName in interface I_CmsPrincipalpublic String getPassword()
public int getType()
Possible options are
for a system user (incliding the "Guest" user),
or USER_TYPE_SYSTEMUSER for a webuser.USER_TYPE_WEBUSER
public String getZipcode()
public int hashCode()
I_CmsPrincipal
hashCode in interface I_CmsPrincipalhashCode in class ObjectObject.hashCode()public boolean isEnabled()
It should replace the method.getDisabled()
public boolean isGuestUser()
true if this user is the default guest user.
public boolean isSystemUser()
true if this user is a system user.
public boolean isTouched()
public boolean isWebUser()
true if this user is a web user.
public void setAdditionalInfo(Map additionalInfo)
Additional infos are for example emailadress, adress or surname...
This method has package-visibility for security-reasons.
It is required to because of the use of two seprate databases for user data and
additional user data.
additionalInfo - user-related additional information
public void setAdditionalInfo(String key,
Object obj)
Additional infos are for example emailadress, adress or surname...
key - The key to the additional informationobj - The additinoal information valuepublic void setAddress(String value)
value - The user adresspublic void setCity(String city)
city - the citypublic void setCountry(String country)
country - the countrypublic void setDescription(String value)
value - the description of this userpublic void setDisabled()
public void setEmail(String value)
value - The new email adresspublic void setEnabled()
public void setEnabled(boolean enabled)
It should replace the and
the setDisabled() methods.setEnabled()
enabled - the enabled flagpublic void setFirstname(String firstname)
firstname - the USER_FIRSTNAMEpublic void setFlags(int value)
value - The new user flagspublic void setLastlogin(long value)
value - The new user sectionpublic void setLastname(String lastname)
lastname - the last name of the userpublic void setName(String name)
name - the name (login) to setpublic void setPassword(String value)
value - The new passwordpublic void setZipcode(String zipcode)
zipcode - the zip codepublic String toString()
toString in class ObjectObject.toString()public void touch()
public static List filterCore(List users)
I_CmsPrincipal.FLAG_CORE_LIMIT.
users - the list of CmsUser
public static List filterFlag(List users,
int flag)
users - the list of CmsUserflag - the flag for filtering
public static List filterCoreFlag(List users,
int flag)
I_CmsPrincipal.FLAG_CORE_LIMIT.
users - the list of CmsUserflag - the flag for filtering
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||