info.magnolia.cms.security
Class RescueSecuritySupport.RescueUser

java.lang.Object
  extended by info.magnolia.cms.security.RescueSecuritySupport.RescueUser
All Implemented Interfaces:
User, Serializable
Enclosing class:
RescueSecuritySupport

protected class RescueSecuritySupport.RescueUser
extends Object
implements User

TODO extract as top level class? Currently this class is tested implicitly by RescueSecuritySupportTest.

A "fake" user, that is a user who is created in-memory rather than relying on a working users repository, as the latter may be corrupted and in need of being fixed.

See MAGNOLIA-3561.

Version:
$Id$
See Also:
Serialized Form

Constructor Summary
RescueSecuritySupport.RescueUser(String name, String password)
           
 
Method Summary
 void addGroup(String groupName)
          Adds this user to a group.
 void addRole(String roleName)
          Adds a role to this user.
 Collection<String> getAllGroups()
          Get all groups to which this user belongs to, collected recursively including.
 Collection<String> getAllRoles()
          Get all roles assigned to this user, collected recursively including groups/subgroups.
 Collection<String> getGroups()
          Get groups that are directly assigned to the user.
 String getLanguage()
           
 String getName()
           
 String getPassword()
           
 String getProperty(String propertyName)
          Gets an arbitrary property from this user.
 Collection<String> getRoles()
          Get roles that are directly assigned to the user.
 Subject getSubject()
          Returns the jaas subject if available.
 boolean hasRole(String roleName)
          Is this user in a specified role?
 boolean inGroup(String groupName)
          Is this user in a specified group?
 boolean isEnabled()
          Returns false if the user was explicitly disabled.
 void removeGroup(String groupName)
          Remove a group.
 void removeRole(String roleName)
          Remove a role.
 void setEnabled(boolean enabled)
           
 void setProperty(String propertyName, String value)
          Sets an arbitrary property for this user.
 void setSubject(Subject subject)
          The jass login handler will set the subject.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RescueSecuritySupport.RescueUser

public RescueSecuritySupport.RescueUser(String name,
                                        String password)
Method Detail

hasRole

public boolean hasRole(String roleName)
Description copied from interface: User
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(String roleName)
                throws UnsupportedOperationException
Description copied from interface: User
Remove a role. Implementation is optional

Specified by:
removeRole in interface User
Throws:
UnsupportedOperationException

addRole

public void addRole(String roleName)
             throws UnsupportedOperationException
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
Throws:
UnsupportedOperationException

inGroup

public boolean inGroup(String groupName)
Description copied from interface: User
Is this user in a specified group?

Specified by:
inGroup in interface User
Returns:
true if in group

removeGroup

public void removeGroup(String groupName)
                 throws UnsupportedOperationException
Description copied from interface: User
Remove a group. Implementation is optional

Specified by:
removeGroup in interface User
Throws:
UnsupportedOperationException

addGroup

public void addGroup(String groupName)
              throws UnsupportedOperationException
Description copied from interface: User
Adds this user to a group. Implementation is optional

Specified by:
addGroup in interface User
Throws:
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

getLanguage

public String getLanguage()
Specified by:
getLanguage in interface User

getName

public String getName()
Specified by:
getName in interface User

getPassword

public String getPassword()
Specified by:
getPassword in interface User

getProperty

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

Specified by:
getProperty in interface User

setProperty

public void setProperty(String propertyName,
                        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 Collection<String> getGroups()
Description copied from interface: User
Get groups that are directly assigned to the user.

Specified by:
getGroups in interface User

getAllGroups

public Collection<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 Collection<String> getRoles()
Description copied from interface: User
Get roles that are directly assigned to the user.

Specified by:
getRoles in interface User

getAllRoles

public Collection<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

getSubject

public Subject getSubject()
Description copied from interface: User
Returns the jaas subject if available.

Specified by:
getSubject in interface User

setSubject

public void setSubject(Subject subject)
Description copied from interface: User
The jass login handler will set the subject.

Specified by:
setSubject in interface User


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