org.apache.catalina.users

Class MemoryUser

public class MemoryUser extends AbstractUser

Concrete implementation of User for the MemoryUserDatabase implementation of UserDatabase.

Since: 4.1

Version: $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (Tue, 24 Oct 2006) $

Author: Craig R. McClanahan

Field Summary
protected MemoryUserDatabasedatabase
The MemoryUserDatabase that owns this user.
protected ArrayListgroups
The set of Groups that this user is a member of.
protected ArrayListroles
The set of Roles associated with this user.
Method Summary
voidaddGroup(Group group)
Add a new Group to those this user belongs to.
voidaddRole(Role role)
Add a new Role to those assigned specifically to this user.
IteratorgetGroups()
Return the set of Groups to which this user belongs.
IteratorgetRoles()
Return the set of Roles assigned specifically to this user.
UserDatabasegetUserDatabase()
Return the UserDatabase within which this User is defined.
booleanisInGroup(Group group)
Is this user in the specified group?
booleanisInRole(Role role)
Is this user specifically assigned the specified Role?
voidremoveGroup(Group group)
Remove a Group from those this user belongs to.
voidremoveGroups()
Remove all Groups from those this user belongs to.
voidremoveRole(Role role)
Remove a Role from those assigned to this user.
voidremoveRoles()
Remove all Roles from those assigned to this user.
StringtoString()

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.

Field Detail

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 Detail

addGroup

public void addGroup(Group group)
Add a new Group to those this user belongs to.

Parameters: group The new group

addRole

public void addRole(Role role)
Add a new Role to those assigned specifically to this user.

Parameters: role The new role

getGroups

public Iterator getGroups()
Return the set of Groups to which this user belongs.

getRoles

public Iterator getRoles()
Return the set of Roles assigned specifically to this user.

getUserDatabase

public UserDatabase getUserDatabase()
Return the UserDatabase within which this User is defined.

isInGroup

public boolean isInGroup(Group group)
Is this user in the specified group?

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.

Parameters: role The role to check

removeGroup

public void removeGroup(Group group)
Remove a Group from those this user belongs to.

Parameters: group The old group

removeGroups

public void removeGroups()
Remove all Groups from those this user belongs to.

removeRole

public void removeRole(Role role)
Remove a Role from those assigned to this user.

Parameters: role The old role

removeRoles

public void removeRoles()
Remove all Roles from those assigned to this user.

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 © 2000-2011 Apache Software Foundation. All Rights Reserved.