|
|
|
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.torweg.pulse.util.entity.AbstractBasicEntity
org.torweg.pulse.util.entity.AbstractNamedEntity
org.torweg.pulse.util.entity.AbstractNamableEntity
org.torweg.pulse.accesscontrol.AbstractAccessControlObject
org.torweg.pulse.accesscontrol.AbstractUserBase
org.torweg.pulse.accesscontrol.User
@Entity public class User
A User is an entity representing a user in the pulse
container.
Every User consists of a unique name and a password that are both
used for authentication.
| Nested Class Summary | |
|---|---|
static class |
User.Everybody
is a dummy User used for non-logged-in users to provide them the
"~Everybody" Role for access checks. |
static class |
User.State
the state of the User. |
| Field Summary |
|---|
| Fields inherited from class org.torweg.pulse.accesscontrol.AbstractUserBase |
|---|
EVERYBODY, PASSWORD_CHARACTERS |
| Constructor Summary | |
|---|---|
protected |
User()
Deprecated. |
|
User(PreliminaryUser p)
creates a new User from a given PreliminaryUser . |
|
User(java.lang.String newName,
java.lang.String newEmail,
java.lang.String newPassword)
The Constructor that sets name, email-address and password of the
User. |
| Method Summary | |
|---|---|
protected boolean |
addAttribute(UserAttribute att)
sets an attribute of the User. |
boolean |
addGroup(Group grp)
Adds a Group to the User's Set of Groups. |
boolean |
addPermission(Permission permission)
Adds a Permission to the User's Set of
Permissions. |
boolean |
addPersistentRole(Role rl)
Adds a Role to the User's Set of Roles. |
boolean |
addSessionRole(Role rl)
Adds a Role to the User's Set of Session
-valid-only Roles. |
boolean |
checkPassword(java.lang.String pwd)
Checks if a String pwd is equal to the User's password. |
protected void |
clearAttributes()
clears all attributes of the User. |
org.jdom.Element |
deserializeToJDOM()
Serializes the state of the User as a JDOM Element. |
org.jdom.Element |
deserializeToJDOMShallow()
serialises the User without Group, Role,
Permission and Attribute information. |
boolean |
expunge()
expunges the User. |
java.util.Set<UserAttribute> |
getAttributes()
Deprecated. |
AbstractValue<?> |
getAttributeValue(AbstractAttribute<?> a)
returns the user's value for the given attribute, or null, if the
user does not have a stored value for the given attribute. |
java.util.Set<? extends AbstractValue<?>> |
getAttributeValues()
returns the user's values. |
java.lang.String |
getEmail()
Returns the email-address of the User. |
java.util.Set<Group> |
getGroups()
Returns a shallow copy of the User's Collection of
Groups. |
java.util.Date |
getLastLoginTime()
Returns the Date indicating the last login time of the
User. |
java.lang.String |
getPassword()
returns the digested password. |
java.util.Set<Permission> |
getPermissions()
Returns a shallow copy of the User's Collection of
Permissions. |
java.util.Set<Role> |
getPersistentRoles()
Returns a shallow copy of the User's Collection of
Roles. |
java.util.Set<Role> |
getRoles()
Returns all Roles associated with the current User, which
can be Session-valid-only Roles as well as the persisted
Roles. |
java.util.Set<Role> |
getSessionRoles()
|
java.util.Locale |
getSignUpLocale()
returns the sign-up locale. |
boolean |
hasAllowanceFor(Command command)
Checks if the associated User has the necessary
Permissions for executing a Command. |
boolean |
hasAllowanceFor(SitemapNode node)
Checks if the associated User has the necessary Roles for
accessing a SitemapNode. |
java.lang.Boolean |
isActive()
Returns the active-flag of the User. |
boolean |
isExpunged()
returns whether the User is expunged. |
java.lang.Boolean |
isSuperuser()
Returns the superuser-flag of the User. |
boolean |
isWebdavEnabled()
returns whether the user is enabled for WebDAV. |
protected boolean |
removeAttribute(UserAttribute att)
removes an attribute from the User. |
AbstractValue<?> |
removeAttributeValue(AbstractAttribute<?> a)
removes the value of a given attribute form the user. |
boolean |
removeGroup(Group grp)
Removes a Group from the User's Set of
Groups if it is part of it. |
boolean |
removePermission(Permission permission)
Removes a Permission from the User's Set of
Permissions if it is part of it. |
boolean |
removePersistentRole(Role rl)
Removes a Role from the User's Set of
Roles if it is part of it. |
boolean |
removeSessionRole(Role rl)
Removes a Role from the User's Set of
Session-valid-only Roles if it is part of it. |
void |
setAttributeValue(AbstractValue<?> v)
sets the given value for the user. |
void |
setEmail(java.lang.String newEmail)
Sets the email-address of the User. |
void |
setLastLoginTime()
Sets the Date indicating the last login time of the User
to the present moment. |
void |
setLastModificationTime()
Sets the Date indicating the last modification time of the
User to the present moment. |
void |
setName(java.lang.String newName)
Sets the name of the User. |
void |
setPassword(java.lang.String newPassword)
Sets the password of the User. |
void |
setSignUpLocale(java.util.Locale l)
sets the sign-up locale. |
void |
setSuperuser(java.lang.Boolean newFlag)
Sets the superuser-flag of the User. |
void |
setWebdavEnabled(boolean b)
sets whether the user is enabled for WebDAV. |
void |
toggleActive()
Toggles the active-flag of the User. |
net.sf.json.JSONObject |
toJSON()
Serialises the state of the User as a JSONObject. |
| Methods inherited from class org.torweg.pulse.accesscontrol.AbstractUserBase |
|---|
generatePassword, generateToken, getCommandMatchers, getEveryBodyId, getEverybodyRole, getSuperUser, getUser, getUser, initEverybodyRole |
| Methods inherited from class org.torweg.pulse.accesscontrol.AbstractAccessControlObject |
|---|
getAssociatedAbstractAccessControlObjects, getLoadCriteriaForClassWithAlias |
| Methods inherited from class org.torweg.pulse.util.entity.AbstractNamedEntity |
|---|
getName |
| Methods inherited from class org.torweg.pulse.util.entity.AbstractBasicEntity |
|---|
compareTo, equals, getFullQualifiedClassNameJAXB, getId, hashCode |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.torweg.pulse.util.INamed |
|---|
getName |
| Constructor Detail |
|---|
@Deprecated protected User()
public User(java.lang.String newName,
java.lang.String newEmail,
java.lang.String newPassword)
Constructor that sets name, email-address and password of the
User.
newName - the name of the UsernewEmail - the email-address of the UsernewPassword - the password of the Userpublic User(PreliminaryUser p)
User from a given PreliminaryUser .
p - the preliminary user| Method Detail |
|---|
public final void setName(java.lang.String newName)
User.
setName in interface INameablesetName in class AbstractNamableEntitynewName - the new name of the UserINameable.setName(java.lang.String)public final java.lang.String getEmail()
User.
Userpublic final void setEmail(java.lang.String newEmail)
User.
newEmail - the new email-address of the Userpublic final boolean checkPassword(java.lang.String pwd)
String pwd is equal to the User's password.
pwd - the String used for the equality check
String pwd is equal to the User's
passwordpublic final java.lang.String getPassword()
public final void setPassword(java.lang.String newPassword)
User.
newPassword - the new password of the Userpublic final java.lang.Boolean isSuperuser()
User.
Userpublic final void setSuperuser(java.lang.Boolean newFlag)
User.
newFlag - the new superuser-flag of the Userpublic final java.lang.Boolean isActive()
User.
Userpublic final void toggleActive()
User.
public final boolean isExpunged()
User is expunged.
true, if the User is expungedpublic final boolean expunge()
User.
true, if and only if the User could be expunged.
Otherwise false.public final void setLastModificationTime()
Date indicating the last modification time of the
User to the present moment.
public java.util.Date getLastLoginTime()
Date indicating the last login time of the
User.
Date indicating the last login time of the
Userpublic final void setLastLoginTime()
Date indicating the last login time of the User
to the present moment.
public final java.util.Set<Group> getGroups()
User's Collection of
Groups.
Attention: Since the returned Set is not a reference to the
User's internal Collection, any modifications to its
state will get lost. However, modifications to the state of the
Set's elements will be consistent.
For example: Adding/Deleting a Group to/from the Set will
not have any effect, when the User is saved. On the other hand,
modifications to a Group in the Set will be made
persistent, when the Group is saved.
Groups associated with the Userpublic final boolean addGroup(Group grp)
Group to the User's Set of Groups.
If it already is part of the Set, it will not be added.
grp - the Group to be added
Set changed as a result of the callpublic final boolean removeGroup(Group grp)
Group from the User's Set of
Groups if it is part of it.
grp - the Group to be removed
Set changed as a result of the callpublic final java.util.Set<Permission> getPermissions()
User's Collection of
Permissions.
Attention: Since the returned Set is not a reference to the
User's internal Collection, any modifications to its
state will get lost. However, modifications to the state of the
Set's elements will be consistent.
For example: Adding/Deleting a Permission to/from the Set
will not have any effect, when the User is saved. On the other
hand, modifications to a Permission in the Set will be
made persistent, when the Permission is saved.
Permissions associated with the Userpublic final boolean addPermission(Permission permission)
Permission to the User's Set of
Permissions. If it already is part of the Set, it will
not be added.
permission - the Permission to be added
Set changed as a result of the callpublic final boolean removePermission(Permission permission)
Permission from the User's Set of
Permissions if it is part of it.
permission - the Permission to be removed
Set changed as a result of the callpublic final java.util.Set<Role> getRoles()
Roles associated with the current User, which
can be Session-valid-only Roles as well as the persisted
Roles.
Roles associated with the User which are
getPersistentRoles() + getSessionRoles()public final java.util.Set<Role> getPersistentRoles()
User's Collection of
Roles.
Attention: Since the returned Set is not a reference to the
User's internal Collection, any modifications to its
state will get lost. However, modifications to the state of the
Set's elements will be consistent.
For example: Adding/Deleting a Role to/from the Set will
not have any effect, when the User is saved. On the other hand,
modifications to a Role in the Set will be made
persistent, when the Role is saved.
Roles associated with the Userpublic final boolean addPersistentRole(Role rl)
Role to the User's Set of Roles.
If it already is part of the Set, it will not be added.
rl - the Role to be added
Set changed as a result of the callpublic final boolean removePersistentRole(Role rl)
Role from the User's Set of
Roles if it is part of it.
rl - the Role to be removed
Set changed as a result of the callpublic final java.util.Set<Role> getSessionRoles()
Roles associated with the User for the
current Sessionpublic final boolean addSessionRole(Role rl)
Role to the User's Set of Session
-valid-only Roles. If it already is part of the Set, it
will not be added.
rl - the Role to be added
Set changed as a result of the callpublic final boolean removeSessionRole(Role rl)
Role from the User's Set of
Session-valid-only Roles if it is part of it.
rl - the Role to be removed
Set changed as a result of the callpublic final boolean isWebdavEnabled()
public final void setWebdavEnabled(boolean b)
b - the value to setpublic final java.util.Set<? extends AbstractValue<?>> getAttributeValues()
Set<AbstractValue>public final AbstractValue<?> getAttributeValue(AbstractAttribute<?> a)
null, if the
user does not have a stored value for the given attribute.
a - the attribute
nullpublic final void setAttributeValue(AbstractValue<?> v)
v - the value to setpublic final AbstractValue<?> removeAttributeValue(AbstractAttribute<?> a)
a - the attribute
public final boolean hasAllowanceFor(Command command)
User has the necessary
Permissions for executing a Command.
command - the Command defining the necessary Permissions
true if the associated User has the necessary
Permissionspublic final boolean hasAllowanceFor(SitemapNode node)
User has the necessary Roles for
accessing a SitemapNode.
node - the node to check against
true, if either the node is null, the node has no
roles or the user does contain at least one of the roles
attached. Otherwise false.@Deprecated public final java.util.Set<UserAttribute> getAttributes()
User.
Userprotected final boolean addAttribute(UserAttribute att)
User.
att - the attribute to be set
true, if and only if, the attribute was successfully setprotected final boolean removeAttribute(UserAttribute att)
User.
att - the attribute to be removed
true, if and only if, the attribute was successfully
removedprotected final void clearAttributes()
User.
public final org.jdom.Element deserializeToJDOM()
User as a JDOM Element.
deserializeToJDOM in interface JDOMableUser as a JDOM Elementpublic final java.util.Locale getSignUpLocale()
public final void setSignUpLocale(java.util.Locale l)
l - the localepublic final org.jdom.Element deserializeToJDOMShallow()
User without Group, Role,
Permission and Attribute information.
public final net.sf.json.JSONObject toJSON()
User as a JSONObject.
toJSON in class AbstractAccessControlObjectUser as a JSONObject
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||