Package ome.security.policy
Interface Policy
-
- All Known Implementing Classes:
BasePolicy,BinaryAccessPolicy
public interface PolicyStrategy to permit the flexible restriction of certain actions throughout OMERO. Code which intends to allow such checks should create a newPolicyclass with a uniquenameand add checks within that code. For example:public class MyPolicy implements Policy { public final static string NAME = "MyPolicy"; public String getName() { return NAME; } } public void someImportantMethod() { IObject objBeingAccessed = ...; policyService.checkRestriction(MyPolicy.NAME, objBeingAccessed); // Here an exception may be thrown }
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcheckRestriction(ome.model.IObject obj)LikeisRestricted(IObject)but throws an appropriateSecurityViolationsubclass if the restriction is active.java.lang.StringgetName()Unique name for a class of restrictions that thisPolicywill enforce.java.util.Set<java.lang.Class<ome.model.IObject>>getTypes()booleanisRestricted(ome.model.IObject obj)Checks whether or not this instance would throw aSecurityViolationif the same instance were passed tocheckRestriction(IObject).
-
-
-
Method Detail
-
getName
java.lang.String getName()
Unique name for a class of restrictions that thisPolicywill enforce. This string will be sent to clients viaPermissions.copyExtendedRestrictions()in order to prevent exceptions, and server-code will pass the same name to the check method to potentially have an exception thrown.
-
getTypes
java.util.Set<java.lang.Class<ome.model.IObject>> getTypes()
EachPolicyshould tell thePolicyServicewhich types ofIObjectinstances it cares about. Only those which are of interest to somePolicyneed be considered.
-
isRestricted
boolean isRestricted(ome.model.IObject obj)
Checks whether or not this instance would throw aSecurityViolationif the same instance were passed tocheckRestriction(IObject). This is likely determined by first testing the type of theIObjectand then that the current user context has access to the given context.- Parameters:
obj- a non-nullIObjectinstance.- Returns:
- true if this
Policydecides that a restriction should be placed on the passed context.
-
checkRestriction
void checkRestriction(ome.model.IObject obj) throws ome.conditions.SecurityViolationLikeisRestricted(IObject)but throws an appropriateSecurityViolationsubclass if the restriction is active.- Throws:
ome.conditions.SecurityViolation
-
-