public class CurrentDetails extends java.lang.Object implements PrincipalHolder
Constructor and Description |
---|
CurrentDetails()
Default constructor.
|
CurrentDetails(SessionCache cache) |
CurrentDetails(SessionCache cache,
ome.system.Roles roles,
SystemTypes sysTypes,
LightAdminPrivileges adminPrivileges,
java.util.Set<java.lang.String> managedRepoUuids,
java.util.Set<java.lang.String> scriptRepoUuids) |
Modifier and Type | Method and Description |
---|---|
boolean |
addAllDisabled(java.lang.String... ids) |
void |
addCleanup(RegisterServiceCleanupMessage cleanup)
Add a
RegisterServiceCleanupMessage to the current thread for
cleanup by the ServiceHandler on exit. |
boolean |
addDisabled(java.lang.String id) |
void |
addLog(java.lang.String action,
java.lang.Class klass,
java.lang.Long id) |
void |
applyContext(ome.model.internal.Details details,
boolean changePerms) |
protected void |
checkDelayedCallContext(BasicEventContext bec) |
void |
clearDisabled() |
void |
clearLogs() |
ome.model.internal.Details |
createDetails()
Creates a
Details object for the current security context. |
java.util.Set<RegisterServiceCleanupMessage> |
emptyCleanups()
Returns the current cleanups and resets the
Set . |
java.util.Set<ome.model.enums.AdminPrivilege> |
getAdminPrivileges() |
java.util.Map<java.lang.String,java.lang.String> |
getContext() |
ome.system.EventContext |
getCurrentEventContext() |
ome.model.meta.Event |
getEvent() |
ome.model.meta.ExperimenterGroup |
getGroup() |
ome.system.Principal |
getLast()
Get the last, i.e.
|
java.util.List<ome.model.meta.EventLog> |
getLogs() |
ome.model.meta.Experimenter |
getOwner() |
SessionStats |
getStats() |
ome.model.meta.Experimenter |
getSudoer() |
void |
invalidateCurrentEventContext()
It suffices to set the
Details to a new instance to make this
context unusable. |
boolean |
isCurrentUserGuest() |
boolean |
isDisabled(java.lang.String id) |
boolean |
isGraphCritical(ome.model.internal.Details details) |
boolean |
isOwnerOrSupervisor(ome.model.IObject object) |
boolean |
isReady()
Checks if the current
Thread has non-null Experimenter ,
Event , and ExperimenterGroup , required for proper
functioning of the security system. |
void |
loadPermissions(org.hibernate.Session session)
Checks the "groupPermissions" map in
BasicEventContext which has
been filled up by calls to BasicEventContext.setPermissionsForGroup(Long, Permissions)
during BasicACLVoter.allowLoad(org.hibernate.Session, Class, Details, long) . |
void |
login(BasicEventContext bec)
Login method which can be used by the security system to replace the
existing
BasicEventContext . |
void |
login(ome.system.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(java.lang.String... ids) |
boolean |
removeDisabled(java.lang.String id) |
java.util.Map<java.lang.String,java.lang.String> |
setContext(java.util.Map<java.lang.String,java.lang.String> ctx) |
int |
size()
Get the number of active principal contexts.
|
public CurrentDetails()
public CurrentDetails(SessionCache cache)
public CurrentDetails(SessionCache cache, ome.system.Roles roles, SystemTypes sysTypes, LightAdminPrivileges adminPrivileges, java.util.Set<java.lang.String> managedRepoUuids, java.util.Set<java.lang.String> scriptRepoUuids)
public java.util.Map<java.lang.String,java.lang.String> setContext(java.util.Map<java.lang.String,java.lang.String> ctx)
public java.util.Map<java.lang.String,java.lang.String> getContext()
protected void checkDelayedCallContext(BasicEventContext bec)
public int size()
PrincipalHolder
size
in interface PrincipalHolder
public ome.system.Principal getLast()
PrincipalHolder
getLast
in interface PrincipalHolder
public void login(ome.system.Principal principal)
PrincipalHolder
login
in interface PrincipalHolder
principal
- the principal to addpublic void login(BasicEventContext bec)
BasicEventContext
.login
in interface PrincipalHolder
bec
- the event context to usepublic int logout()
PrincipalHolder
logout
in interface PrincipalHolder
public boolean isReady()
Thread
has non-null Experimenter
,
Event
, and ExperimenterGroup
, required for proper
functioning of the security system.public boolean isGraphCritical(ome.model.internal.Details details)
public boolean isOwnerOrSupervisor(ome.model.IObject object)
public ome.system.EventContext getCurrentEventContext()
public void invalidateCurrentEventContext()
Details
to a new instance to make this
context unusable. isReady()
will return false.public ome.model.meta.Event newEvent(ome.model.meta.Session session, ome.model.enums.EventType type, TokenHolder tokenHolder)
public void addLog(java.lang.String action, java.lang.Class klass, java.lang.Long id)
public SessionStats getStats()
public java.util.List<ome.model.meta.EventLog> getLogs()
public void clearLogs()
public ome.model.internal.Details createDetails()
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.public void applyContext(ome.model.internal.Details details, boolean changePerms)
public void loadPermissions(org.hibernate.Session session)
BasicEventContext
which has
been filled up by calls to BasicEventContext.setPermissionsForGroup(Long, Permissions)
during BasicACLVoter.allowLoad(org.hibernate.Session, Class, Details, long)
.session
- the Hibernate sessionpublic ome.model.meta.Experimenter getOwner()
public ome.model.meta.Experimenter getSudoer()
public ome.model.meta.ExperimenterGroup getGroup()
public java.util.Set<ome.model.enums.AdminPrivilege> getAdminPrivileges()
public ome.model.meta.Event getEvent()
public boolean isCurrentUserGuest()
guestuser
public void addCleanup(RegisterServiceCleanupMessage cleanup)
RegisterServiceCleanupMessage
to the current thread for
cleanup by the ServiceHandler
on exit.public java.util.Set<RegisterServiceCleanupMessage> emptyCleanups()
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.public boolean addDisabled(java.lang.String id)
public boolean addAllDisabled(java.lang.String... ids)
public boolean removeDisabled(java.lang.String id)
public boolean removeAllDisabled(java.lang.String... ids)
public void clearDisabled()
public boolean isDisabled(java.lang.String id)