|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectome.security.basic.OmeroInterceptor
public class OmeroInterceptor
implements Interceptor
for controlling various aspects
of the Hibernate runtime. Where no special requirements exist, methods
delegate to EmptyInterceptor
Current responsibilities include the proper (re-)setting of Details
EmptyInterceptor
,
Interceptor
Constructor Summary | |
---|---|
OmeroInterceptor(Roles roles,
SystemTypes sysTypes,
ExtendedMetadata em,
CurrentDetails cd,
TokenHolder tokenHolder,
SessionStats stats)
|
Method Summary | |
---|---|
void |
afterTransactionBegin(org.hibernate.Transaction tx)
|
void |
afterTransactionCompletion(org.hibernate.Transaction tx)
|
void |
beforeTransactionCompletion(org.hibernate.Transaction tx)
|
ome.model.internal.Details |
checkManagedDetails(ome.model.IObject iobj,
ome.model.internal.Details previousDetails)
|
void |
evaluateLinkages(ome.model.IObject iObject)
Checks the details of the objects which the given object links to in order to guarantee that linkages are valid. |
int[] |
findDirty(Object entity,
Serializable id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
org.hibernate.type.Type[] types)
default logic |
Object |
getEntity(String entityName,
Serializable id)
|
String |
getEntityName(Object object)
|
Object |
instantiate(String entityName,
org.hibernate.EntityMode entityMode,
Serializable id)
default logic, but we may want to use them eventually for dependency-injection. |
Boolean |
isTransient(Object entity)
|
protected void |
log(String msg)
|
protected boolean |
managedEvent(boolean privileged,
ome.model.IObject obj,
ome.model.internal.Details previousDetails,
ome.model.internal.Details currentDetails,
ome.model.internal.Details newDetails)
|
protected boolean |
managedExternalInfo(boolean privileged,
ome.model.IObject obj,
ome.model.internal.Details previousDetails,
ome.model.internal.Details currentDetails,
ome.model.internal.Details newDetails)
responsible for guaranteeing that external info is not modified by any users, including rot. |
protected boolean |
managedGroup(boolean privileged,
ome.model.IObject obj,
ome.model.internal.Details previousDetails,
ome.model.internal.Details currentDetails,
ome.model.internal.Details newDetails,
ome.security.basic.BasicEventContext bec)
|
protected boolean |
managedOwner(boolean privileged,
ome.model.IObject obj,
ome.model.internal.Details previousDetails,
ome.model.internal.Details currentDetails,
ome.model.internal.Details newDetails,
ome.security.basic.BasicEventContext bec)
|
protected boolean |
managedPermissions(boolean privileged,
ome.model.IObject obj,
ome.model.internal.Details previousDetails,
ome.model.internal.Details currentDetails,
ome.model.internal.Details newDetails,
boolean sysType)
responsible for properly copying user-requested permissions taking into account the Flag#LOCKED status. |
ome.model.internal.Details |
newTransientDetails(ome.model.IObject obj)
|
void |
onCollectionRecreate(Object collection,
Serializable key)
|
void |
onCollectionRemove(Object collection,
Serializable key)
|
void |
onCollectionUpdate(Object collection,
Serializable key)
|
void |
onDelete(Object entity,
Serializable id,
Object[] state,
String[] propertyNames,
org.hibernate.type.Type[] types)
default logic |
boolean |
onFlushDirty(Object entity,
Serializable id,
Object[] currentState,
Object[] previousState,
String[] propertyNames,
org.hibernate.type.Type[] types)
callsback to BasicSecuritySystem.checkManagedDetails(IObject, Details) for
properly setting Details . |
boolean |
onLoad(Object entity,
Serializable id,
Object[] state,
String[] propertyNames,
org.hibernate.type.Type[] types)
default logic. |
String |
onPrepareStatement(String sql)
|
boolean |
onSave(Object entity,
Serializable id,
Object[] state,
String[] propertyNames,
org.hibernate.type.Type[] types)
callsback to BasicSecuritySystem.newTransientDetails(IObject) for
properly setting Details |
void |
postFlush(Iterator entities)
|
void |
preFlush(Iterator entities)
|
protected boolean |
resetDetails(ome.model.IObject entity,
Object[] currentState,
Object[] previousState,
int idx)
asks BasicSecuritySystem to create a new managed Details
based on the previous state of this entity. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OmeroInterceptor(Roles roles, SystemTypes sysTypes, ExtendedMetadata em, CurrentDetails cd, TokenHolder tokenHolder, SessionStats stats)
Method Detail |
---|
public Object instantiate(String entityName, org.hibernate.EntityMode entityMode, Serializable id) throws org.hibernate.CallbackException
instantiate
in interface org.hibernate.Interceptor
org.hibernate.CallbackException
public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, org.hibernate.type.Type[] types) throws org.hibernate.CallbackException
onLoad
in interface org.hibernate.Interceptor
org.hibernate.CallbackException
public int[] findDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, org.hibernate.type.Type[] types)
findDirty
in interface org.hibernate.Interceptor
public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, org.hibernate.type.Type[] types)
BasicSecuritySystem.newTransientDetails(IObject)
for
properly setting Details
onSave
in interface org.hibernate.Interceptor
public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, org.hibernate.type.Type[] types)
BasicSecuritySystem.checkManagedDetails(IObject, Details)
for
properly setting Details
.
onFlushDirty
in interface org.hibernate.Interceptor
public void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, org.hibernate.type.Type[] types) throws org.hibernate.CallbackException
onDelete
in interface org.hibernate.Interceptor
org.hibernate.CallbackException
public void onCollectionRecreate(Object collection, Serializable key) throws org.hibernate.CallbackException
onCollectionRecreate
in interface org.hibernate.Interceptor
org.hibernate.CallbackException
public void onCollectionRemove(Object collection, Serializable key) throws org.hibernate.CallbackException
onCollectionRemove
in interface org.hibernate.Interceptor
org.hibernate.CallbackException
public void onCollectionUpdate(Object collection, Serializable key) throws org.hibernate.CallbackException
onCollectionUpdate
in interface org.hibernate.Interceptor
org.hibernate.CallbackException
public void preFlush(Iterator entities) throws org.hibernate.CallbackException
preFlush
in interface org.hibernate.Interceptor
org.hibernate.CallbackException
public void postFlush(Iterator entities) throws org.hibernate.CallbackException
postFlush
in interface org.hibernate.Interceptor
org.hibernate.CallbackException
public void afterTransactionBegin(org.hibernate.Transaction tx)
afterTransactionBegin
in interface org.hibernate.Interceptor
public void afterTransactionCompletion(org.hibernate.Transaction tx)
afterTransactionCompletion
in interface org.hibernate.Interceptor
public void beforeTransactionCompletion(org.hibernate.Transaction tx)
beforeTransactionCompletion
in interface org.hibernate.Interceptor
public Object getEntity(String entityName, Serializable id) throws org.hibernate.CallbackException
getEntity
in interface org.hibernate.Interceptor
org.hibernate.CallbackException
public String getEntityName(Object object) throws org.hibernate.CallbackException
getEntityName
in interface org.hibernate.Interceptor
org.hibernate.CallbackException
public Boolean isTransient(Object entity)
isTransient
in interface org.hibernate.Interceptor
public String onPrepareStatement(String sql)
onPrepareStatement
in interface org.hibernate.Interceptor
protected boolean resetDetails(ome.model.IObject entity, Object[] currentState, Object[] previousState, int idx)
BasicSecuritySystem
to create a new managed Details
based on the previous state of this entity. If the previous state is null
(see ticket:3929) then throw an exception.
entity
- IObject to be updatedcurrentState
- the possibly changed field data for this entitypreviousState
- the field data as seen in the dbidx
- the index of Details in the state arrays.protected void log(String msg)
public void evaluateLinkages(ome.model.IObject iObject)
save
and
update
since this is the only time that new entity references can be
created.
iObject
- new or updated entity which may reference other entities which
then require locking. Nulls are tolerated but do nothing.ownerId
- the id of the current owner. May be null in which case, the
current owner id will most likely be replaced. (If not, then
a security exception will be raised later)public ome.model.internal.Details newTransientDetails(ome.model.IObject obj)
SecuritySystem.newTransientDetails(IObject)
public ome.model.internal.Details checkManagedDetails(ome.model.IObject iobj, ome.model.internal.Details previousDetails)
SecuritySystem.checkManagedDetails(IObject, Details)
protected boolean managedExternalInfo(boolean privileged, ome.model.IObject obj, ome.model.internal.Details previousDetails, ome.model.internal.Details currentDetails, ome.model.internal.Details newDetails)
locked
- privileged
- obj
- previousDetails
- details representing the known DB statecurrentDetails
- details representing the user request (UNTRUSTED)newDetails
- details from the current context. Holder for the merged
Permissions
Permissions
of newDetails are changed.protected boolean managedPermissions(boolean privileged, ome.model.IObject obj, ome.model.internal.Details previousDetails, ome.model.internal.Details currentDetails, ome.model.internal.Details newDetails, boolean sysType)
Flag#LOCKED
status. This method does not need to
(like newTransientDetails(IObject)
take into account the session
umask available from CurrentDetails.createDetails()
locked
- privileged
- obj
- previousDetails
- details representing the known DB statecurrentDetails
- details representing the user request (UNTRUSTED)newDetails
- details from the current context. Holder for the merged
Permissions
Permissions
of newDetails are changed.protected boolean managedOwner(boolean privileged, ome.model.IObject obj, ome.model.internal.Details previousDetails, ome.model.internal.Details currentDetails, ome.model.internal.Details newDetails, ome.security.basic.BasicEventContext bec)
protected boolean managedGroup(boolean privileged, ome.model.IObject obj, ome.model.internal.Details previousDetails, ome.model.internal.Details currentDetails, ome.model.internal.Details newDetails, ome.security.basic.BasicEventContext bec)
protected boolean managedEvent(boolean privileged, ome.model.IObject obj, ome.model.internal.Details previousDetails, ome.model.internal.Details currentDetails, ome.model.internal.Details newDetails)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Version: 4.3.4-dbcbce5a-b4
Copyright © 2009 The University of Dundee. All Rights Reserved.