org.figure8.join.view
Class UserView

java.lang.Object
  extended by org.figure8.join.view.UserView
All Implemented Interfaces:
java.io.Serializable

public class UserView
extends java.lang.Object
implements java.io.Serializable

This is a JavaBean encapsulating a User domain model object and its permission. This is necessary because in our model, a User is decoupled from its security permission.
Instance of UserView class are intended to be stored within a HttpSession.

Version:
$Revision: 1.2 $
Author:
Laurent Broudoux
See Also:
Serialized Form

Field Summary
protected  java.lang.String clearPassword
          Non encrypted password of user (the one provided through authentication form) This is necessary in case of user calling a remote Join web-service that expect clear password for doing its own authentication.
protected  java.util.HashMap permissions
          Map containing user's permission.
protected  User user
          The encapsulated user domain object
 
Constructor Summary
UserView(User user)
          Creates a new instance of UserView
UserView(User user, java.util.List permissions)
          Creates a new instance of UserView with a set of Permissions
 
Method Summary
 void addPermission(Permission permission)
          Add a security permission to this user.
 java.lang.String getClearPassword()
           
 java.util.Collection getPermissions()
           
 java.util.Collection getPermissions(Role role)
           
 User getUser()
           
 boolean hasPermission(Role role)
          Tells if this user has permission to endorse this security role
 boolean hasPermissionForResource(java.lang.Object resource, Role role)
          Tells if this user has permission to endorse this security role for this resource
 void setClearPassword(java.lang.String clearPassword)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

user

protected User user
The encapsulated user domain object


permissions

protected java.util.HashMap permissions
Map containing user's permission. Keys are security roles, values are permissions on different resources for this role.


clearPassword

protected java.lang.String clearPassword
Non encrypted password of user (the one provided through authentication form) This is necessary in case of user calling a remote Join web-service that expect clear password for doing its own authentication. Not so unsafe because clear password will only be kept in VM memory...

Constructor Detail

UserView

public UserView(User user)
Creates a new instance of UserView

Parameters:
user - The encasuplated user business object

UserView

public UserView(User user,
                java.util.List permissions)
Creates a new instance of UserView with a set of Permissions

Parameters:
user - The encasuplated user business object
permissions - A list of org.figure8.join.businessobjects.security.Permissions
Method Detail

getUser

public User getUser()
Returns:
The encapsulated user business object

addPermission

public void addPermission(Permission permission)
Add a security permission to this user.

Parameters:
permission - Permission to add

getPermissions

public java.util.Collection getPermissions()
Returns:
All the permissions acquired by this user

getPermissions

public java.util.Collection getPermissions(Role role)
Parameters:
role - The security role to filter permissions for
Returns:
All the permissions correspondinf to role acquired by this user

hasPermission

public boolean hasPermission(Role role)
Tells if this user has permission to endorse this security role

Parameters:
role - Security role that has to be endorsed by user
Returns:
true is user as permission corresponding to role, false otherwise

hasPermissionForResource

public boolean hasPermissionForResource(java.lang.Object resource,
                                        Role role)
Tells if this user has permission to endorse this security role for this resource

Parameters:
resource - Entity for whom user should have permission
role - Security role that has to be endorsed by user
Returns:
true is user as permission corresponding to role for resource, false otherwise

getClearPassword

public java.lang.String getClearPassword()
Returns:
The non encrypted password of wrapped user

setClearPassword

public void setClearPassword(java.lang.String clearPassword)
Parameters:
clearPassword - The non encrypted password of wrapped user


Copyright © 2005-2008 Join. All Rights Reserved.