Package ome.security
Class CompositeACLVoter
- java.lang.Object
-
- ome.security.CompositeACLVoter
-
-
Constructor Summary
Constructors Constructor Description CompositeACLVoter(CurrentDetails cd, BasicACLVoter basic, SharingACLVoter sharing)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallowAnnotate(ome.model.IObject object, ome.model.internal.Details trustedDetails)test whether the given object should be annotatable given the trusteddetails.booleanallowChmod(ome.model.IObject object)test whether the given object can have itsPermissionschanged within the currentsecurity context.booleanallowCreation(ome.model.IObject object)test whether the given object should be insertable into the DB.booleanallowDelete(ome.model.IObject object, 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 object, ome.model.internal.Details trustedDetails)test whether the given object should be updateable given the trusteddetails.ACLVoterchoose()voidpostProcess(ome.model.IObject object)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 object)throws aSecurityViolationbased on the givenIObjectand the context of the current user.voidthrowDeleteViolation(ome.model.IObject object)throws aSecurityViolationbased on the givenIObjectand the context of the current user.voidthrowLoadViolation(ome.model.IObject object)throws aSecurityViolationbased on the givenIObjectand the context of the current user.voidthrowUpdateViolation(ome.model.IObject object)throws aSecurityViolationbased on the givenIObjectand the context of the current user.
-
-
-
Constructor Detail
-
CompositeACLVoter
public CompositeACLVoter(CurrentDetails cd, BasicACLVoter basic, SharingACLVoter sharing)
-
-
Method Detail
-
choose
public ACLVoter choose()
-
allowChmod
public boolean allowChmod(ome.model.IObject object)
Description copied from interface:ACLVotertest whether the given object can have itsPermissionschanged within the currentsecurity context.- Specified by:
allowChmodin interfaceACLVoter- Parameters:
object- a model object- Returns:
- if the object's permissions may be changed
-
allowCreation
public boolean allowCreation(ome.model.IObject object)
Description copied from interface:ACLVotertest 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 callACLVoter.throwCreationViolation(IObject)if this method returns false.- Specified by:
allowCreationin interfaceACLVoter- Parameters:
object- 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)
-
allowDelete
public boolean allowDelete(ome.model.IObject object, ome.model.internal.Details trustedDetails)Description copied from interface:ACLVotertest 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 callACLVoter.throwDeleteViolation(IObject)if this method returns false.- Specified by:
allowDeletein interfaceACLVoter- Parameters:
object- 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)
-
allowLoad
public boolean allowLoad(org.hibernate.Session session, java.lang.Class<? extends ome.model.IObject> klass, ome.model.internal.Details trustedDetails, long id)Description copied from interface:ACLVotertest 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 callACLVoter.throwLoadViolation(IObject)if this method returns false.- Specified by:
allowLoadin interfaceACLVoter- 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)
-
allowAnnotate
public boolean allowAnnotate(ome.model.IObject object, ome.model.internal.Details trustedDetails)Description copied from interface:ACLVotertest 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.- Specified by:
allowAnnotatein interfaceACLVoter- Parameters:
object- 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
public boolean allowUpdate(ome.model.IObject object, ome.model.internal.Details trustedDetails)Description copied from interface:ACLVotertest 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 callACLVoter.throwUpdateViolation(IObject)if this method returns false.- Specified by:
allowUpdatein interfaceACLVoter- Parameters:
object- 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)
-
throwCreationViolation
public void throwCreationViolation(ome.model.IObject object) throws ome.conditions.SecurityViolationDescription copied from interface:ACLVoterthrows aSecurityViolationbased on the givenIObjectand the context of the current user.- Specified by:
throwCreationViolationin interfaceACLVoter- Parameters:
object- Non-null object which caused this violation- Throws:
ome.conditions.SecurityViolation- See Also:
ACLEventListener.onPreInsert(org.hibernate.event.PreInsertEvent)
-
throwDeleteViolation
public void throwDeleteViolation(ome.model.IObject object) throws ome.conditions.SecurityViolationDescription copied from interface:ACLVoterthrows aSecurityViolationbased on the givenIObjectand the context of the current user.- Specified by:
throwDeleteViolationin interfaceACLVoter- Parameters:
object- Non-null object which caused this violation- Throws:
ome.conditions.SecurityViolation- See Also:
ACLEventListener.onPreDelete(org.hibernate.event.PreDeleteEvent)
-
throwLoadViolation
public void throwLoadViolation(ome.model.IObject object) throws ome.conditions.SecurityViolationDescription copied from interface:ACLVoterthrows aSecurityViolationbased on the givenIObjectand the context of the current user.- Specified by:
throwLoadViolationin interfaceACLVoter- Parameters:
object- Non-null object which caused this violation- Throws:
ome.conditions.SecurityViolation- See Also:
ACLEventListener.onPostLoad(org.hibernate.event.PostLoadEvent)
-
throwUpdateViolation
public void throwUpdateViolation(ome.model.IObject object) throws ome.conditions.SecurityViolationDescription copied from interface:ACLVoterthrows aSecurityViolationbased on the givenIObjectand the context of the current user.- Specified by:
throwUpdateViolationin interfaceACLVoter- Parameters:
object- Non-null object which caused this violation- Throws:
ome.conditions.SecurityViolation- See Also:
ACLEventListener.onPreUpdate(org.hibernate.event.PreUpdateEvent)
-
restrictions
public java.util.Set<java.lang.String> restrictions(ome.model.IObject object)
Description copied from interface:ACLVoterProvide the active restrictions for thisIObject. SeePolicyServicefor further details.- Specified by:
restrictionsin interfaceACLVoter- Parameters:
object- a model object- Returns:
- the restrictions applying for the object
-
setPermittedClasses
public void setPermittedClasses(java.util.Map<java.lang.Integer,java.util.Set<java.lang.Class<? extends ome.model.IObject>>> objectClassesPermitted)
Description copied from interface:ACLVoterSpecify 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.- Specified by:
setPermittedClassesin interfaceACLVoter- Parameters:
objectClassesPermitted- the map from restriction constants to object classes that may not have those restrictions
-
postProcess
public void postProcess(ome.model.IObject object)
Description copied from interface:ACLVoterGives theACLVoterinstance a chance to act on theIObjectafter the transaction but before finishing the AOP stack.- Specified by:
postProcessin interfaceACLVoter- Parameters:
object- a model object
-
-