org.apache.catalina.users

Class MemoryUser

Implemented Interfaces:
Principal, User

public class MemoryUser
extends AbstractUser

Concrete implementation of User for the MemoryUserDatabase implementation of UserDatabase.

Version:
$Revision: 1.4 $ $Date: 2004/02/27 14:58:50 $

Author:
Craig R. McClanahan

Since:
4.1

Field Summary

protected MemoryUserDatabase
database
The MemoryUserDatabase that owns this user.
protected ArrayList
groups
The set of Groups that this user is a member of.
protected ArrayList
roles
The set of Roles associated with this user.

Fields inherited from class org.apache.catalina.users.AbstractUser

fullName, password, username

Method Summary

void
addGroup(Group group)
Add a new Group to those this user belongs to.
void
addRole(Role role)
Add a new Role to those assigned specifically to this user.
Iterator
getGroups()
Return the set of Groups to which this user belongs.
Iterator
getRoles()
Return the set of Roles assigned specifically to this user.
UserDatabase
getUserDatabase()
Return the UserDatabase within which this User is defined.
boolean
isInGroup(Group group)
Is this user in the specified group?
boolean
isInRole(Role role)
Is this user specifically assigned the specified Role? This method does NOT check for roles inherited based on Group membership.
void
removeGroup(Group group)
Remove a Group from those this user belongs to.
void
removeGroups()
Remove all Groups from those this user belongs to.
void
removeRole(Role role)
Remove a Role from those assigned to this user.
void
removeRoles()
Remove all Roles from those assigned to this user.
String
toString()
Return a String representation of this user in XML format.

Methods inherited from class org.apache.catalina.users.AbstractUser

addGroup, addRole, getFullName, getGroups, getName, getPassword, getRoles, getUsername, isInGroup, isInRole, removeGroup, removeGroups, removeRole, removeRoles, setFullName, setPassword, setUsername

Field Details

database

protected MemoryUserDatabase database
The MemoryUserDatabase that owns this user.


groups

protected ArrayList groups
The set of Groups that this user is a member of.


roles

protected ArrayList roles
The set of Roles associated with this user.

Method Details

addGroup

public void addGroup(Group group)
Add a new Group to those this user belongs to.
Specified by:
addGroup in interface User
Overrides:
addGroup in interface AbstractUser

Parameters:
group - The new group


addRole

public void addRole(Role role)
Add a new Role to those assigned specifically to this user.
Specified by:
addRole in interface User
Overrides:
addRole in interface AbstractUser

Parameters:
role - The new role


getGroups

public Iterator getGroups()
Return the set of Groups to which this user belongs.
Specified by:
getGroups in interface User
Overrides:
getGroups in interface AbstractUser


getRoles

public Iterator getRoles()
Return the set of Roles assigned specifically to this user.
Specified by:
getRoles in interface User
Overrides:
getRoles in interface AbstractUser


getUserDatabase

public UserDatabase getUserDatabase()
Return the UserDatabase within which this User is defined.
Specified by:
getUserDatabase in interface User


isInGroup

public boolean isInGroup(Group group)
Is this user in the specified group?
Specified by:
isInGroup in interface User
Overrides:
isInGroup in interface AbstractUser

Parameters:
group - The group to check


isInRole

public boolean isInRole(Role role)
Is this user specifically assigned the specified Role? This method does NOT check for roles inherited based on Group membership.
Specified by:
isInRole in interface User
Overrides:
isInRole in interface AbstractUser

Parameters:
role - The role to check


removeGroup

public void removeGroup(Group group)
Remove a Group from those this user belongs to.
Specified by:
removeGroup in interface User
Overrides:
removeGroup in interface AbstractUser

Parameters:
group - The old group


removeGroups

public void removeGroups()
Remove all Groups from those this user belongs to.
Specified by:
removeGroups in interface User
Overrides:
removeGroups in interface AbstractUser


removeRole

public void removeRole(Role role)
Remove a Role from those assigned to this user.
Specified by:
removeRole in interface User
Overrides:
removeRole in interface AbstractUser

Parameters:
role - The old role


removeRoles

public void removeRoles()
Remove all Roles from those assigned to this user.
Specified by:
removeRoles in interface User
Overrides:
removeRoles in interface AbstractUser


toString

public String toString()
Return a String representation of this user in XML format.

IMPLEMENTATION NOTE - For backwards compatibility, the reader that processes this entry will accept either username or name for the username property.


Copyright B) 2000-2003 Apache Software Foundation. All Rights Reserved.