ome.security.sharing
Class SharingACLVoter

java.lang.Object
  extended by ome.security.sharing.SharingACLVoter
All Implemented Interfaces:
ACLVoter

public class SharingACLVoter
extends Object
implements ACLVoter

Since:
3.0-Beta4
Author:
Josh Moore, josh at glencoesoftware.com
See Also:
IShare

Constructor Summary
SharingACLVoter(CurrentDetails cd, SystemTypes sysTypes, ShareStore store)
           
 
Method Summary
 boolean allowChmod(ome.model.IObject iObject)
          test whether the given object can have its Permissions changed within the current security context.
 boolean allowCreation(ome.model.IObject iObject)
          test whether the given object should be insertable into the DB.
 boolean allowDelete(ome.model.IObject iObject, ome.model.internal.Details trustedDetails)
          test whether the given object should be deleteable given the trusted details.
 boolean allowLoad(Class<? extends ome.model.IObject> klass, ome.model.internal.Details d, long id)
          test whether the object of the given Class with the given Details should be loadable in the current security context.
 boolean allowUpdate(ome.model.IObject iObject, ome.model.internal.Details trustedDetails)
          test whether the given object should be updateable given the trusted details.
 void throwCreationViolation(ome.model.IObject iObject)
          throws a SecurityViolation based on the given IObject and the context of the current user.
 void throwDeleteViolation(ome.model.IObject iObject)
          throws a SecurityViolation based on the given IObject and the context of the current user.
protected  void throwDisabled(String action)
           
 void throwLoadViolation(ome.model.IObject iObject)
          throws a SecurityViolation based on the given IObject and the context of the current user.
 void throwUpdateViolation(ome.model.IObject iObject)
          throws a SecurityViolation based on the given IObject and the context of the current user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SharingACLVoter

public SharingACLVoter(CurrentDetails cd,
                       SystemTypes sysTypes,
                       ShareStore store)
Method Detail

allowChmod

public boolean allowChmod(ome.model.IObject iObject)
Description copied from interface: ACLVoter
test whether the given object can have its Permissions changed within the current security context.

Specified by:
allowChmod in interface ACLVoter

allowLoad

public boolean allowLoad(Class<? extends ome.model.IObject> klass,
                         ome.model.internal.Details d,
                         long id)
Description copied from interface: ACLVoter
test whether the object of the given Class with the given Details should be loadable in the current security context. This method does not take an actual object because that will not be generated until after loading is permitted. The SecuritySystem implementors will usually call ACLVoter.throwLoadViolation(IObject) if this method returns false.

Specified by:
allowLoad in interface ACLVoter
Parameters:
klass - a non-null class to test for loading
id - the id of the object which will be loaded. As opposed to the rest of the object, this must be known.
Returns:
true if loading of this object can proceed
See Also:
ACLEventListener.onPostLoad(org.hibernate.event.PostLoadEvent)

throwLoadViolation

public void throwLoadViolation(ome.model.IObject iObject)
                        throws ome.conditions.SecurityViolation
Description copied from interface: ACLVoter
throws a SecurityViolation based on the given IObject and the context of the current user.

Specified by:
throwLoadViolation in interface ACLVoter
Parameters:
iObject - Non-null object which caused this violation
Throws:
ome.conditions.SecurityViolation
See Also:
ACLEventListener#onPostLoad(org.hibernate.event.PostLoadEvent)}

allowCreation

public boolean allowCreation(ome.model.IObject iObject)
Description copied from interface: ACLVoter
test whether the given object should be insertable into the DB. No trusted details is passed to this method, since for transient entities there are no trusted values. The SecuritySystem implementors will usually call ACLVoter.throwCreationViolation(IObject) if this method returns false.

Specified by:
allowCreation in interface ACLVoter
Parameters:
iObject - a non-null entity to test for creation.
Returns:
true if creation of this object can proceed
See Also:
ACLEventListener.onPreInsert(org.hibernate.event.PreInsertEvent)

throwCreationViolation

public void throwCreationViolation(ome.model.IObject iObject)
                            throws ome.conditions.SecurityViolation
Description copied from interface: ACLVoter
throws a SecurityViolation based on the given IObject and the context of the current user.

Specified by:
throwCreationViolation in interface ACLVoter
Parameters:
iObject - Non-null object which caused this violation
Throws:
ome.conditions.SecurityViolation
See Also:
ACLEventListener#onPreInsert(org.hibernate.event.PreInsertEvent)}

allowUpdate

public boolean allowUpdate(ome.model.IObject iObject,
                           ome.model.internal.Details trustedDetails)
Description copied from interface: ACLVoter
test whether the given object should be updateable given the trusted details. The details will usually be retrieved from the current state array coming from the database. The SecuritySystem implementors will usually call ACLVoter.throwUpdateViolation(IObject) if this method returns false.

Specified by:
allowUpdate in interface ACLVoter
Parameters:
iObject - a non-null entity to test for update.
trustedDetails - a Details instance that is known to be valid.
Returns:
true if update of this object can proceed
See Also:
ACLEventListener.onPreUpdate(org.hibernate.event.PreUpdateEvent)

throwUpdateViolation

public void throwUpdateViolation(ome.model.IObject iObject)
                          throws ome.conditions.SecurityViolation
Description copied from interface: ACLVoter
throws a SecurityViolation based on the given IObject and the context of the current user.

Specified by:
throwUpdateViolation in interface ACLVoter
Parameters:
iObject - Non-null object which caused this violation
Throws:
ome.conditions.SecurityViolation
See Also:
ACLEventListener.onPreUpdate(org.hibernate.event.PreUpdateEvent)

allowDelete

public boolean allowDelete(ome.model.IObject iObject,
                           ome.model.internal.Details trustedDetails)
Description copied from interface: ACLVoter
test whether the given object should be deleteable given the trusted details. The details will usually be retrieved from the current state array coming from the database. The SecuritySystem implementors will usually call ACLVoter.throwDeleteViolation(IObject) if this method returns false.

Specified by:
allowDelete in interface ACLVoter
Parameters:
iObject - a non-null entity to test for deletion.
trustedDetails - a Details instance that is known to be valid.
Returns:
true if deletion of this object can proceed
See Also:
ACLEventListener.onPreDelete(org.hibernate.event.PreDeleteEvent)

throwDeleteViolation

public void throwDeleteViolation(ome.model.IObject iObject)
                          throws ome.conditions.SecurityViolation
Description copied from interface: ACLVoter
throws a SecurityViolation based on the given IObject and the context of the current user.

Specified by:
throwDeleteViolation in interface ACLVoter
Parameters:
iObject - Non-null object which caused this violation
Throws:
ome.conditions.SecurityViolation
See Also:
ACLEventListener.onPreDelete(org.hibernate.event.PreDeleteEvent)

throwDisabled

protected void throwDisabled(String action)


OmeroJava Api

Version: Beta-4.2.0-r7571-b29

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