public class MemoryUser extends AbstractUser
Concrete implementation of User for the
MemoryUserDatabase implementation of UserDatabase.
| Modifier and Type | Field and Description |
|---|---|
protected MemoryUserDatabase |
database
The
MemoryUserDatabase that owns this user. |
protected ArrayList<Group> |
groups
The set of
Groups that this user is a member of. |
protected ArrayList<Role> |
roles
The set of
Roles associated with this user. |
fullName, password, username| Modifier and Type | Method and Description |
|---|---|
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<Group> |
getGroups()
Return the set of
Groups to which this user belongs. |
Iterator<Role> |
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? |
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.
|
String |
toXml()
Return a String representation of this user in XML format.
|
getFullName, getName, getPassword, getUsername, setFullName, setPassword, setUsernameprotected MemoryUserDatabase database
MemoryUserDatabase that owns this user.public Iterator<Group> getGroups()
Groups to which this user belongs.getGroups in interface UsergetGroups in class AbstractUserGroups to which this user belongs.public Iterator<Role> getRoles()
Roles assigned specifically to this user.getRoles in interface UsergetRoles in class AbstractUserRoles assigned specifically to this user.public UserDatabase getUserDatabase()
UserDatabase within which this User is defined.UserDatabase within which this User is defined.public void addGroup(Group group)
Group to those this user belongs to.addGroup in interface UseraddGroup in class AbstractUsergroup - The new grouppublic void addRole(Role role)
Role to those assigned specifically to this user.addRole in interface UseraddRole in class AbstractUserrole - The new rolepublic boolean isInGroup(Group group)
isInGroup in interface UserisInGroup in class AbstractUsergroup - The group to checktrue if the user is in the specified grouppublic boolean isInRole(Role role)
Role? This
method does NOT check for roles inherited based on
Group membership.isInRole in interface UserisInRole in class AbstractUserrole - The role to checktrue if the user has the specified rolepublic void removeGroup(Group group)
Group from those this user belongs to.removeGroup in interface UserremoveGroup in class AbstractUsergroup - The old grouppublic void removeGroups()
Groups from those this user belongs to.removeGroups in interface UserremoveGroups in class AbstractUserpublic void removeRole(Role role)
Role from those assigned to this user.removeRole in interface UserremoveRole in class AbstractUserrole - The old rolepublic void removeRoles()
Roles from those assigned to this user.removeRoles in interface UserremoveRoles in class AbstractUserpublic String toXml()
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-2021 Apache Software Foundation. All Rights Reserved.