org.persvr.security
Class CapabilityUser

java.lang.Object
  extended by NativeObject
      extended by org.persvr.data.PersistableObject
          extended by org.persvr.security.CapabilityObject
              extended by org.persvr.security.CapabilityUser
All Implemented Interfaces:
java.security.acl.Permission, java.security.Principal, ObservablePersistable, Persistable, Capability, User

public class CapabilityUser
extends CapabilityObject
implements User

There are three states of a user: 1. anonymous private - user is maintained across sessions through cookies and can be converted to a real user by establishing a username and password. This is the default state. 2. shared public - multiple users are using this computer so a user is not maintained across sessions 3. authenticated - either one or two can convert to this, but if a user already exists, it must do a merge of data


Nested Class Summary
 
Nested classes/interfaces inherited from class org.persvr.data.PersistableObject
PersistableObject.FullSet
 
Field Summary
 java.util.Map<Persistable,PermissionLevel> computedPermissions
           
static java.lang.String EVERYONE
           
static Persistable PRIVILEDGED_USER_OBJECT
           
static CapabilityUser PUBLIC_USER
           
static java.lang.String PUBLIC_USER_NAME
           
static java.lang.Object SUPER_ROLE
           
static java.util.Map<java.lang.Thread,java.lang.String> threadWebsiteMap
           
static boolean USERS_HAVE_SEPARATE_SPACE_WITHIN_WEBSITES
           
 
Fields inherited from class org.persvr.security.CapabilityObject
FULL_ACCESS, WRITE_ACCESS
 
Fields inherited from class org.persvr.data.PersistableObject
ADDITION, ENTRY_SET_INCLUDE_DONT_ENUM, ENTRY_SET_INCLUDE_GETTER_SETTER_FUNCTIONS, permissionNames
 
Constructor Summary
CapabilityUser()
           
 
Method Summary
static CapabilityUser authenticate(java.lang.String username, java.lang.String password)
           
static java.util.Set<Persistable> calculateMembership(Persistable member, java.util.List groupToConsider)
           
 int compareTo(java.lang.Object o)
           
 PersistableObject getCurrentEditingVersion()
           
 java.lang.String getCurrentTicket()
          Allows a user to return ticket so that the password does not need to be stored for reauthentication This may be moved to a separate interface
static java.lang.String getCurrentWebsiteName()
           
 java.lang.String getName()
           
 java.lang.String getNewTicket(java.lang.String ipAddress)
          Deprecated. 
 java.lang.String getPassword()
           
 int getPermissionLevel(Persistable obj)
          Determines whether this capability can access the given object
static java.security.acl.Group getSupervisorGroup()
           
static CapabilityUser getUserByTicket(java.lang.String id, java.lang.String ipAddress)
           
static CapabilityUser getUserByUsername(java.lang.String username)
           
 PersistableObject getUserData()
           
static Persistable getWebsite()
           
static Persistable getWebsites()
           
static Persistable getWebsiteSourceObject()
           
static boolean isHostSpecificSecurity()
           
 void logout()
           
 void onCreation()
          Called when an persistent object is first created (not when the Java object is created to restore state)
static CapabilityUser publicUser()
          Deprecated. 
static void registerThisWebsite(java.lang.String webappContextName)
          This registers which website we are using for this particular user, which affects the users data and possibly the user table that is used
static void resetSecurity()
           
static void setHostSpecificSecurity(boolean websiteSpecificSecurity)
           
 void setPassword(java.lang.String password)
           
static void setupSecurity()
           
 void setUsername(java.lang.String username)
           
 CapabilityUser su(java.lang.String username)
           
protected static PersistableList usersTable()
           
 
Methods inherited from class org.persvr.security.CapabilityObject
getPermissionLevelForString, grantCapability, grantCapability, grantCapability, hasPermission, put, set
 
Methods inherited from class org.persvr.data.PersistableObject
addListener, checkPut, checkSecurity, commitPut, computeAccessLevel, convertToDateJavaDate, delete, delete, enableSecurity, entrySet, get, get, get, get, getAccessLevel, getCoreValue, getHistory, getId, getIds, getLastModified, getParent, getPermissionObject, getReadSet, getSchema, getWatchSet, initArray, initializeProperty, initObject, isSecurityEnabled, keySet, noCheckGet, put, recordObjectRead, removeListener, resetComputedPermissions, startReadSet, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.persvr.security.Capability
grantCapability, grantCapability, hasPermission
 
Methods inherited from interface java.security.acl.Permission
equals, toString
 
Methods inherited from interface java.security.Principal
equals, hashCode, toString
 

Field Detail

PUBLIC_USER_NAME

public static final java.lang.String PUBLIC_USER_NAME
See Also:
Constant Field Values

computedPermissions

public java.util.Map<Persistable,PermissionLevel> computedPermissions

PUBLIC_USER

public static CapabilityUser PUBLIC_USER

PRIVILEDGED_USER_OBJECT

public static final Persistable PRIVILEDGED_USER_OBJECT

EVERYONE

public static final java.lang.String EVERYONE
See Also:
Constant Field Values

SUPER_ROLE

public static final java.lang.Object SUPER_ROLE

USERS_HAVE_SEPARATE_SPACE_WITHIN_WEBSITES

public static final boolean USERS_HAVE_SEPARATE_SPACE_WITHIN_WEBSITES
See Also:
Constant Field Values

threadWebsiteMap

public static java.util.Map<java.lang.Thread,java.lang.String> threadWebsiteMap
Constructor Detail

CapabilityUser

public CapabilityUser()
Method Detail

getPermissionLevel

public int getPermissionLevel(Persistable obj)
Description copied from interface: Capability
Determines whether this capability can access the given object

Specified by:
getPermissionLevel in interface Capability
Overrides:
getPermissionLevel in class CapabilityObject
Returns:

resetSecurity

public static void resetSecurity()

onCreation

public void onCreation()
Description copied from interface: Persistable
Called when an persistent object is first created (not when the Java object is created to restore state)

Specified by:
onCreation in interface Persistable
Overrides:
onCreation in class CapabilityObject

getSupervisorGroup

public static java.security.acl.Group getSupervisorGroup()

publicUser

@Deprecated
public static CapabilityUser publicUser()
Deprecated. 


getCurrentTicket

public java.lang.String getCurrentTicket()
Description copied from interface: User
Allows a user to return ticket so that the password does not need to be stored for reauthentication This may be moved to a separate interface

Specified by:
getCurrentTicket in interface User
Returns:
ticket

getUserByTicket

public static CapabilityUser getUserByTicket(java.lang.String id,
                                             java.lang.String ipAddress)
                                      throws javax.security.auth.login.LoginException
Throws:
javax.security.auth.login.LoginException

getNewTicket

@Deprecated
public java.lang.String getNewTicket(java.lang.String ipAddress)
Deprecated. 


getUserByUsername

public static CapabilityUser getUserByUsername(java.lang.String username)

authenticate

public static CapabilityUser authenticate(java.lang.String username,
                                          java.lang.String password)
                                   throws javax.security.auth.login.LoginException
Throws:
javax.security.auth.login.LoginException

usersTable

protected static PersistableList usersTable()

logout

public void logout()

getName

public java.lang.String getName()
Specified by:
getName in interface java.security.Principal

getPassword

public java.lang.String getPassword()

setUsername

public void setUsername(java.lang.String username)

su

public CapabilityUser su(java.lang.String username)

setPassword

public void setPassword(java.lang.String password)

calculateMembership

public static java.util.Set<Persistable> calculateMembership(Persistable member,
                                                             java.util.List groupToConsider)

compareTo

public int compareTo(java.lang.Object o)

getUserData

public PersistableObject getUserData()

registerThisWebsite

public static void registerThisWebsite(java.lang.String webappContextName)
This registers which website we are using for this particular user, which affects the users data and possibly the user table that is used


getCurrentWebsiteName

public static java.lang.String getCurrentWebsiteName()

getWebsite

public static Persistable getWebsite()

getWebsiteSourceObject

public static Persistable getWebsiteSourceObject()

getWebsites

public static Persistable getWebsites()

getCurrentEditingVersion

public PersistableObject getCurrentEditingVersion()

isHostSpecificSecurity

public static boolean isHostSpecificSecurity()

setHostSpecificSecurity

public static void setHostSpecificSecurity(boolean websiteSpecificSecurity)

setupSecurity

public static void setupSecurity()