Package ome.security
Interface ACLVoter
-
- All Known Implementing Classes:
BasicACLVoter,CompositeACLVoter,SharingACLVoter
public interface ACLVoterhelper security interface for all decisions on access control- Since:
- 3.0-M3
- See Also:
SecuritySystem,ACLEventListener
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanallowAnnotate(ome.model.IObject iObject, ome.model.internal.Details trustedDetails)test whether the given object should be annotatable given the trusteddetails.booleanallowChmod(ome.model.IObject iObject)test whether the given object can have itsPermissionschanged within the currentsecurity context.booleanallowCreation(ome.model.IObject iObject)test whether the given object should be insertable into the DB.booleanallowDelete(ome.model.IObject iObject, ome.model.internal.Details trustedDetails)test whether the given object should be deleteable given the trusteddetails.booleanallowLoad(org.hibernate.Session session, java.lang.Class<? extends ome.model.IObject> klass, ome.model.internal.Details trustedDetails, long id)test whether the object of the givenClasswith the givenDetailsshould be loadable in the current security context.booleanallowUpdate(ome.model.IObject iObject, ome.model.internal.Details trustedDetails)test whether the given object should be updateable given the trusteddetails.voidpostProcess(ome.model.IObject obj)Gives theACLVoterinstance a chance to act on theIObjectafter the transaction but before finishing the AOP stack.java.util.Set<java.lang.String>restrictions(ome.model.IObject object)Provide the active restrictions for thisIObject.voidsetPermittedClasses(java.util.Map<java.lang.Integer,java.util.Set<java.lang.Class<? extends ome.model.IObject>>> objectClassesPermitted)Specify object classes based on restriction constants inPermissionsthat do not always have those restrictions.voidthrowCreationViolation(ome.model.IObject iObject)throws aSecurityViolationbased on the givenIObjectand the context of the current user.voidthrowDeleteViolation(ome.model.IObject iObject)throws aSecurityViolationbased on the givenIObjectand the context of the current user.voidthrowLoadViolation(ome.model.IObject iObject)throws aSecurityViolationbased on the givenIObjectand the context of the current user.voidthrowUpdateViolation(ome.model.IObject iObject)throws aSecurityViolationbased on the givenIObjectand the context of the current user.
-
-
-
Method Detail
-
allowChmod
boolean allowChmod(ome.model.IObject iObject)
test whether the given object can have itsPermissionschanged within the currentsecurity context.- Parameters:
iObject- a model object- Returns:
- if the object's permissions may be changed
-
allowLoad
boolean allowLoad(org.hibernate.Session session, java.lang.Class<? extends ome.model.IObject> klass, ome.model.internal.Details trustedDetails, long id)test whether the object of the givenClasswith the givenDetailsshould 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. TheSecuritySystemimplementors will usually callthrowLoadViolation(IObject)if this method returns false.- Parameters:
session- the Hibernate session to use for the queryklass- a non-null class to test for loadingtrustedDetails- the non-null trusted details (usually from the db) for this instanceid- 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)
-
allowCreation
boolean allowCreation(ome.model.IObject iObject)
test whether the given object should be insertable into the DB. No trusteddetailsis passed to this method, since for transient entities there are no trusted values. TheSecuritySystemimplementors will usually callthrowCreationViolation(IObject)if this method returns false.- 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)
-
allowAnnotate
boolean allowAnnotate(ome.model.IObject iObject, ome.model.internal.Details trustedDetails)test whether the given object should be annotatable given the trusteddetails. The details will usually be retrieved from the current state array coming from the database.- Parameters:
iObject- a non-null entity to test for update.trustedDetails- aDetailsinstance that is known to be valid.- Returns:
- true if annotation of this object can proceed
-
allowUpdate
boolean allowUpdate(ome.model.IObject iObject, ome.model.internal.Details trustedDetails)test whether the given object should be updateable given the trusteddetails. The details will usually be retrieved from the current state array coming from the database. TheSecuritySystemimplementors will usually callthrowUpdateViolation(IObject)if this method returns false.- Parameters:
iObject- a non-null entity to test for update.trustedDetails- aDetailsinstance that is known to be valid.- Returns:
- true if update of this object can proceed
- See Also:
ACLEventListener.onPreUpdate(org.hibernate.event.PreUpdateEvent)
-
allowDelete
boolean allowDelete(ome.model.IObject iObject, ome.model.internal.Details trustedDetails)test whether the given object should be deleteable given the trusteddetails. The details will usually be retrieved from the current state array coming from the database. TheSecuritySystemimplementors will usually callthrowDeleteViolation(IObject)if this method returns false.- Parameters:
iObject- a non-null entity to test for deletion.trustedDetails- aDetailsinstance that is known to be valid.- Returns:
- true if deletion of this object can proceed
- See Also:
ACLEventListener.onPreDelete(org.hibernate.event.PreDeleteEvent)
-
throwLoadViolation
void throwLoadViolation(ome.model.IObject iObject) throws ome.conditions.SecurityViolationthrows aSecurityViolationbased on the givenIObjectand the context of the current user.- Parameters:
iObject- Non-null object which caused this violation- Throws:
ome.conditions.SecurityViolation- See Also:
ACLEventListener.onPostLoad(org.hibernate.event.PostLoadEvent)
-
throwCreationViolation
void throwCreationViolation(ome.model.IObject iObject) throws ome.conditions.SecurityViolationthrows aSecurityViolationbased on the givenIObjectand the context of the current user.- Parameters:
iObject- Non-null object which caused this violation- Throws:
ome.conditions.SecurityViolation- See Also:
ACLEventListener.onPreInsert(org.hibernate.event.PreInsertEvent)
-
throwUpdateViolation
void throwUpdateViolation(ome.model.IObject iObject) throws ome.conditions.SecurityViolationthrows aSecurityViolationbased on the givenIObjectand the context of the current user.- Parameters:
iObject- Non-null object which caused this violation- Throws:
ome.conditions.SecurityViolation- See Also:
ACLEventListener.onPreUpdate(org.hibernate.event.PreUpdateEvent)
-
throwDeleteViolation
void throwDeleteViolation(ome.model.IObject iObject) throws ome.conditions.SecurityViolationthrows aSecurityViolationbased on the givenIObjectand the context of the current user.- Parameters:
iObject- Non-null object which caused this violation- Throws:
ome.conditions.SecurityViolation- See Also:
ACLEventListener.onPreDelete(org.hibernate.event.PreDeleteEvent)
-
restrictions
java.util.Set<java.lang.String> restrictions(ome.model.IObject object)
Provide the active restrictions for thisIObject. SeePolicyServicefor further details.- Parameters:
object- a model object- Returns:
- the restrictions applying for the object
-
setPermittedClasses
void setPermittedClasses(java.util.Map<java.lang.Integer,java.util.Set<java.lang.Class<? extends ome.model.IObject>>> objectClassesPermitted)
Specify object classes based on restriction constants inPermissionsthat do not always have those restrictions. Previously set classes may not be cleared by subsequent calls to this method.- Parameters:
objectClassesPermitted- the map from restriction constants to object classes that may not have those restrictions
-
postProcess
void postProcess(ome.model.IObject obj)
Gives theACLVoterinstance a chance to act on theIObjectafter the transaction but before finishing the AOP stack.- Parameters:
obj- a model object
-
-