ome.security.basic
Class CurrentDetails

java.lang.Object
  extended by ome.security.basic.CurrentDetails
All Implemented Interfaces:
PrincipalHolder

public class CurrentDetails
extends Object
implements PrincipalHolder

Stores information related to the security context of the current thread. Code calling into the server must setup CurrentDetails properly. An existing user must be set (the creation of a new user is only allowed if the current user is set to root; root always exists. QED.) The event must also be set. Umask is optional. This information is stored in a Details object, but unlike Details which assumes that an empty value signifies increased security levels, empty values here signifiy reduced security levels. E.g., Details: user == null ==> object belongs to root CurrentDetails: user == null ==> current user is "nobody" (anonymous)


Constructor Summary
CurrentDetails()
          Default constructor.
CurrentDetails(SessionCache cache)
           
 
Method Summary
 boolean addAllDisabled(String... ids)
           
 void addCleanup(RegisterServiceCleanupMessage cleanup)
          Add a RegisterServiceCleanupMessage to the current thread for cleanup by the ServiceHandler on exit.
 boolean addDisabled(String id)
           
 void addLog(String action, Class klass, Long id)
           
 void clearDisabled()
           
 void clearLogs()
           
 ome.model.internal.Details createDetails()
          Creates a Details object for the current security context.
 Set<RegisterServiceCleanupMessage> emptyCleanups()
          Returns the current cleanups and resets the Set.
 Long getCallGroup()
           
 EventContext getCurrentEventContext()
          Public view on the data contained here.
 ome.model.meta.Event getEvent()
           
 ome.model.meta.ExperimenterGroup getGroup()
           
 Principal getLast()
          Get the last, i.e. currently active, principal.
 List<ome.model.meta.EventLog> getLogs()
           
 ome.model.meta.Experimenter getOwner()
           
 SessionStats getStats()
           
 void invalidateCurrentEventContext()
          It suffices to set the Details to a new instance to make this context unusable.
 boolean isDisabled(String id)
           
 boolean isGraphCritical()
           
 boolean isOwnerOrSupervisor(ome.model.IObject object)
           
 boolean isReady()
          Checks if the current Thread has non-null Experimenter, Event, and , required for proper functioning of the security system.
 void login(ome.security.basic.BasicEventContext bec)
          Login method which can be used by the security system to replace the existing BasicEventContext.
 void login(Principal principal)
          Add a new principal context to the stack.
 int logout()
          Pop the last created principal context and return the number of active contexts remaining.
 ome.model.meta.Event newEvent(ome.model.meta.Session session, ome.model.enums.EventType type, TokenHolder tokenHolder)
           
 boolean removeAllDisabled(String... ids)
           
 boolean removeDisabled(String id)
           
 void resetCallGroup()
           
 void setCallGroup(Long id)
           
 Map<String,String> setContext(Map<String,String> ctx)
           
 int size()
          Get the number of active principal contexts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CurrentDetails

public CurrentDetails()
Default constructor. Should only be used for testing, since the stats used will not be correct.


CurrentDetails

public CurrentDetails(SessionCache cache)
Method Detail

setContext

public Map<String,String> setContext(Map<String,String> ctx)

getCallGroup

public Long getCallGroup()

setCallGroup

public void setCallGroup(Long id)

resetCallGroup

public void resetCallGroup()

size

public int size()
Description copied from interface: PrincipalHolder
Get the number of active principal contexts.

Specified by:
size in interface PrincipalHolder

getLast

public Principal getLast()
Description copied from interface: PrincipalHolder
Get the last, i.e. currently active, principal.

Specified by:
getLast in interface PrincipalHolder
Returns:

login

public void login(Principal principal)
Description copied from interface: PrincipalHolder
Add a new principal context to the stack.

Specified by:
login in interface PrincipalHolder

login

public void login(ome.security.basic.BasicEventContext bec)
Login method which can be used by the security system to replace the existing BasicEventContext.


logout

public int logout()
Description copied from interface: PrincipalHolder
Pop the last created principal context and return the number of active contexts remaining.

Specified by:
logout in interface PrincipalHolder

isReady

public boolean isReady()
Checks if the current Thread has non-null Experimenter, Event, and , required for proper functioning of the security system.


isGraphCritical

public boolean isGraphCritical()
Returns:
See Also:
SecuritySystem.isGraphCritical()

isOwnerOrSupervisor

public boolean isOwnerOrSupervisor(ome.model.IObject object)

getCurrentEventContext

public EventContext getCurrentEventContext()
Public view on the data contained here. Used to create the

Returns:

invalidateCurrentEventContext

public void invalidateCurrentEventContext()
It suffices to set the Details to a new instance to make this context unusable. isReady() will return false.


newEvent

public ome.model.meta.Event newEvent(ome.model.meta.Session session,
                                     ome.model.enums.EventType type,
                                     TokenHolder tokenHolder)

addLog

public void addLog(String action,
                   Class klass,
                   Long id)

getStats

public SessionStats getStats()

getLogs

public List<ome.model.meta.EventLog> getLogs()

clearLogs

public void clearLogs()

createDetails

public ome.model.internal.Details createDetails()
Creates a Details object for the current security context. The Permissions on the instance are calculated from the current group as well as the user's umask.

Returns:
See Also:
ticket:1434

getOwner

public ome.model.meta.Experimenter getOwner()

getGroup

public ome.model.meta.ExperimenterGroup getGroup()

getEvent

public ome.model.meta.Event getEvent()

addCleanup

public void addCleanup(RegisterServiceCleanupMessage cleanup)
Add a RegisterServiceCleanupMessage to the current thread for cleanup by the ServiceHandler on exit.


emptyCleanups

public Set<RegisterServiceCleanupMessage> emptyCleanups()
Returns the current cleanups and resets the Set. Instances can most likely only be closed once, so it doesn't make sense to keep them around. The first caller of this method is responsible for closing all of them.


addDisabled

public boolean addDisabled(String id)

addAllDisabled

public boolean addAllDisabled(String... ids)

removeDisabled

public boolean removeDisabled(String id)

removeAllDisabled

public boolean removeAllDisabled(String... ids)

clearDisabled

public void clearDisabled()

isDisabled

public boolean isDisabled(String id)


OmeroJava Api

Version: 4.3.4-dbcbce5a-b4

Copyright © 2009 The University of Dundee. All Rights Reserved.