com.opensymphony.user
Class User

java.lang.Object
  extended bycom.opensymphony.user.Entity
      extended bycom.opensymphony.user.User
All Implemented Interfaces:
java.security.Principal, java.io.Serializable

public final class User
extends Entity
implements java.security.Principal

Entity to represent an actual User of the system.

A user's profile is stored in the PropertySet of the Entity - getFullName() and getEmail() are provided for convenient access to the underlying PropertySet.

Refer to Entity for more information.

Version:
$Revision: 1.4 $
Author:
Joe Walnes
See Also:
Entity, Serialized Form

Nested Class Summary
 class User.Accessor
          User specific Accessor.
 
Field Summary
static java.lang.String PROPERTY_EMAIL
          Key that email property is stored under in PropertySet.
static java.lang.String PROPERTY_FULLNAME
          Key that fullName property is stored under in PropertySet.
 
Fields inherited from class com.opensymphony.user.Entity
accessor, mutable, name
 
Method Summary
 boolean addToGroup(Group group)
          Add this User as a member to supplied Group.
 boolean authenticate(java.lang.String password)
          Verify that the supplied password matches the stored password for the user.
 java.lang.String getEmail()
          Convenience method to access property.
 java.lang.String getFullName()
          Convenience method to access property.
 java.util.List getGroups()
          List all Groups that User is a member of.
 boolean inGroup(Group group)
          Determine whether User is member of supplied Group.
 boolean inGroup(java.lang.String groupName)
          Determine whether User is member of supplied Group.
 void remove()
          Remove User from CredentialsProvider (providing it is mutable).
 boolean removeFromGroup(Group group)
          Remove this User as a member from supplied Group.
 void setEmail(java.lang.String email)
          Convenience method to access property.
 void setFullName(java.lang.String fullName)
          Convenience method to access property.
 void setPassword(java.lang.String password)
          Change the User's password.
 void store()
          Force update to underlying data-stores.
 
Methods inherited from class com.opensymphony.user.Entity
equals, getAccessProvider, getCredentialsProvider, getName, getProfileProvider, getPropertySet, getUserManager, hashCode, isMutable, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.security.Principal
equals, getName, hashCode, toString
 

Field Detail

PROPERTY_FULLNAME

public static final java.lang.String PROPERTY_FULLNAME
Key that fullName property is stored under in PropertySet.

See Also:
Constant Field Values

PROPERTY_EMAIL

public static final java.lang.String PROPERTY_EMAIL
Key that email property is stored under in PropertySet.

See Also:
Constant Field Values
Method Detail

setEmail

public void setEmail(java.lang.String email)
Convenience method to access property.


getEmail

public java.lang.String getEmail()
Convenience method to access property.


setFullName

public void setFullName(java.lang.String fullName)
Convenience method to access property.


getFullName

public java.lang.String getFullName()
Convenience method to access property.


getGroups

public java.util.List getGroups()
List all Groups that User is a member of. Modifiying this Collection will not add or remove Groups.


setPassword

public void setPassword(java.lang.String password)
                 throws ImmutableException
Change the User's password.

Throws:
ImmutableException

addToGroup

public boolean addToGroup(Group group)
Add this User as a member to supplied Group. Returns whether any modifications were made.


authenticate

public boolean authenticate(java.lang.String password)
Verify that the supplied password matches the stored password for the user.


inGroup

public boolean inGroup(Group group)
Determine whether User is member of supplied Group.


inGroup

public boolean inGroup(java.lang.String groupName)
Determine whether User is member of supplied Group.


remove

public void remove()
            throws ImmutableException
Remove User from CredentialsProvider (providing it is mutable).

Specified by:
remove in class Entity
Throws:
ImmutableException

removeFromGroup

public boolean removeFromGroup(Group group)
Remove this User as a member from supplied Group. Returns whether any modifications were made.


store

public void store()
           throws ImmutableException
Force update to underlying data-stores. This allows providers that do not update persistent data on the fly to store changes. If any of the providers are immutable and fields that cannot be updated have changed, ImmutableException shall be thrown.

Overrides:
store in class Entity
Throws:
ImmutableException

See www.opensymphony.com for more information.