org.nakedobjects.applib.security
Class UserMemento

java.lang.Object
  extended by org.nakedobjects.applib.security.UserMemento

public final class UserMemento
extends java.lang.Object

Details, obtained from the container, about the user and his roles. Read-only.


Constructor Summary
UserMemento(java.lang.String name)
          Creates a new user with the specified name and no roles.
UserMemento(java.lang.String name, java.util.List<RoleMemento> roles)
          Creates a new user with the specified name and assigned roles.
UserMemento(java.lang.String name, RoleMemento... roles)
          Creates a new user with the specified name and assigned roles.
 
Method Summary
 java.lang.String getName()
          The user's login name.
 java.util.List<RoleMemento> getRoles()
          The roles associated with this user.
 boolean hasRole(RoleMemento role)
          Determines if the user fulfills the specified role.
 boolean hasRole(java.lang.String roleName)
          Determines if the user fulfills the specified role.
 boolean isCurrentUser(java.lang.String user)
          Determine if the specified user is this user.
 java.lang.String title()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UserMemento

public UserMemento(java.lang.String name)
Creates a new user with the specified name and no roles.


UserMemento

public UserMemento(java.lang.String name,
                   RoleMemento... roles)
Creates a new user with the specified name and assigned roles.


UserMemento

public UserMemento(java.lang.String name,
                   java.util.List<RoleMemento> roles)
Creates a new user with the specified name and assigned roles.

Method Detail

title

public java.lang.String title()

getName

public java.lang.String getName()
The user's login name.


isCurrentUser

public boolean isCurrentUser(java.lang.String user)
Determine if the specified user is this user. Returns true if the names match (is case sensitive).


getRoles

public java.util.List<RoleMemento> getRoles()
The roles associated with this user.


hasRole

public boolean hasRole(RoleMemento role)
Determines if the user fulfills the specified role.


hasRole

public boolean hasRole(java.lang.String roleName)
Determines if the user fulfills the specified role. Roles are compared lexically by role name.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2001-2009 Naked Objects Group Ltd.. All Rights Reserved.