info.magnolia.cms.security
Class MgnlUser

java.lang.Object
  extended by info.magnolia.cms.security.AbstractUser
      extended by info.magnolia.cms.security.MgnlUser
All Implemented Interfaces:
User, java.io.Serializable

public class MgnlUser
extends AbstractUser
implements java.io.Serializable

This class wraps a user content object.

Version:
$Revision: 48411 $ ($Author: ochytil $)
See Also:
Serialized Form

Field Summary
 
Fields inherited from class info.magnolia.cms.security.AbstractUser
subject
 
Constructor Summary
protected MgnlUser(Content userNode)
           
 
Method Summary
 void addGroup(java.lang.String groupName)
          Adds this user to a group.
 void addRole(java.lang.String roleName)
          Adds a role to this user.
protected  java.lang.String decodePassword(java.lang.String encodedPassword)
           
 java.util.Collection<java.lang.String> getAllGroups()
          Get all groups to which this user belongs to, collected recursively including.
 java.util.Collection<java.lang.String> getAllRoles()
          Get all roles assigned to this user, collected recursively including groups/subgroups.
 int getFailedLoginAttempts()
           
 java.util.Collection<java.lang.String> getGroups()
          Get groups that are directly assigned to the user.
 java.lang.String getLanguage()
           
 java.lang.String getName()
           
 java.lang.String getPassword()
           
 java.lang.String getProperty(java.lang.String propertyName)
          Gets an arbitrary property from this user.
 java.util.Calendar getReleaseTime()
           
 java.util.Collection<java.lang.String> getRoles()
          Get roles that are directly assigned to the user.
 Content getUserNode()
           
 boolean hasRole(java.lang.String roleName)
          Is this user in a specified role?
 boolean inGroup(java.lang.String groupName)
          Is this user in a specified role?
 boolean isEnabled()
          Returns false if the user was explicitly disabled.
 void removeGroup(java.lang.String groupName)
          Remove a group.
 void removeRole(java.lang.String roleName)
          Remove a role.
 void setEnabled(boolean enabled)
           
 void setFailedLoginAttempts(int failedAttempts)
           
 void setLastAccess()
          Update the "last access" timestamp.
 void setProperty(java.lang.String propertyName, java.lang.String value)
          Sets an arbitrary property for this user.
 void setReleaseTime(java.util.Calendar time)
           
 
Methods inherited from class info.magnolia.cms.security.AbstractUser
getSubject, setSubject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MgnlUser

protected MgnlUser(Content userNode)
Parameters:
userNode - the Content object representing this user
Method Detail

getFailedLoginAttempts

public int getFailedLoginAttempts()

setFailedLoginAttempts

public void setFailedLoginAttempts(int failedAttempts)

getReleaseTime

public java.util.Calendar getReleaseTime()

setReleaseTime

public void setReleaseTime(java.util.Calendar time)

inGroup

public boolean inGroup(java.lang.String groupName)
Is this user in a specified role?

Specified by:
inGroup in interface User
Parameters:
groupName - the name of the role
Returns:
true if in role

removeGroup

public void removeGroup(java.lang.String groupName)
                 throws java.lang.UnsupportedOperationException
Remove a group. Implementation is optional

Specified by:
removeGroup in interface User
Parameters:
groupName -
Throws:
java.lang.UnsupportedOperationException

addGroup

public void addGroup(java.lang.String groupName)
              throws java.lang.UnsupportedOperationException
Adds this user to a group. Implementation is optional

Specified by:
addGroup in interface User
Parameters:
groupName -
Throws:
java.lang.UnsupportedOperationException

isEnabled

public boolean isEnabled()
Description copied from interface: User
Returns false if the user was explicitly disabled. Implementations should return true by default if the status is unknown.

Specified by:
isEnabled in interface User

setEnabled

public void setEnabled(boolean enabled)
Specified by:
setEnabled in interface User

hasRole

public boolean hasRole(java.lang.String roleName)
Is this user in a specified role?

Specified by:
hasRole in interface User
Parameters:
roleName - the name of the role
Returns:
true if in role

removeRole

public void removeRole(java.lang.String roleName)
Description copied from interface: User
Remove a role. Implementation is optional

Specified by:
removeRole in interface User

addRole

public void addRole(java.lang.String roleName)
Description copied from interface: User
Adds a role to this user. Implementation is optional

Specified by:
addRole in interface User
Parameters:
roleName - the name of the role

getName

public java.lang.String getName()
Specified by:
getName in interface User

getPassword

public java.lang.String getPassword()
Specified by:
getPassword in interface User

decodePassword

protected java.lang.String decodePassword(java.lang.String encodedPassword)

getLanguage

public java.lang.String getLanguage()
Specified by:
getLanguage in interface User

getProperty

public java.lang.String getProperty(java.lang.String propertyName)
Description copied from interface: User
Gets an arbitrary property from this user.

Specified by:
getProperty in interface User

setProperty

public void setProperty(java.lang.String propertyName,
                        java.lang.String value)
Description copied from interface: User
Sets an arbitrary property for this user. Values are currently Strings; we'd need some kind of abstract encoding mechanism to allow other types if needed.

Specified by:
setProperty in interface User

getGroups

public java.util.Collection<java.lang.String> getGroups()
Description copied from interface: User
Get groups that are directly assigned to the user.

Specified by:
getGroups in interface User

getAllGroups

public java.util.Collection<java.lang.String> getAllGroups()
Description copied from interface: User
Get all groups to which this user belongs to, collected recursively including.

Specified by:
getAllGroups in interface User

getRoles

public java.util.Collection<java.lang.String> getRoles()
Description copied from interface: User
Get roles that are directly assigned to the user.

Specified by:
getRoles in interface User

getAllRoles

public java.util.Collection<java.lang.String> getAllRoles()
Description copied from interface: User
Get all roles assigned to this user, collected recursively including groups/subgroups.

Specified by:
getAllRoles in interface User

setLastAccess

public void setLastAccess()
Update the "last access" timestamp.


getUserNode

public Content getUserNode()


Copyright © 2003-2011 Magnolia International Ltd.. All Rights Reserved.