Package ome.security.policy
Class BasePolicy
- java.lang.Object
-
- ome.security.policy.BasePolicy
-
- All Implemented Interfaces:
Policy
- Direct Known Subclasses:
BinaryAccessPolicy
public abstract class BasePolicy extends java.lang.Object implements Policy
Simple base class forPolicyimplementations which always returns true forisRestricted(IObject)and always fails oncheckRestriction(IObject).
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Set<java.lang.Class<ome.model.IObject>>types
-
Constructor Summary
Constructors Constructor Description BasePolicy(java.util.Set<java.lang.Class<ome.model.IObject>> types)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcheckRestriction(ome.model.IObject obj)LikePolicy.isRestricted(IObject)but throws an appropriateSecurityViolationsubclass if the restriction is active.abstract 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 toPolicy.checkRestriction(IObject).
-
-
-
Method Detail
-
getName
public abstract java.lang.String getName()
Description copied from interface:PolicyUnique 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
public java.util.Set<java.lang.Class<ome.model.IObject>> getTypes()
Description copied from interface:PolicyEachPolicyshould tell thePolicyServicewhich types ofIObjectinstances it cares about. Only those which are of interest to somePolicyneed be considered.
-
isRestricted
public boolean isRestricted(ome.model.IObject obj)
Description copied from interface:PolicyChecks whether or not this instance would throw aSecurityViolationif the same instance were passed toPolicy.checkRestriction(IObject). This is likely determined by first testing the type of theIObjectand then that the current user context has access to the given context.- Specified by:
isRestrictedin interfacePolicy- Parameters:
obj- a non-nullIObjectinstance.- Returns:
- true if this
Policydecides that a restriction should be placed on the passed context.
-
checkRestriction
public void checkRestriction(ome.model.IObject obj)
Description copied from interface:PolicyLikePolicy.isRestricted(IObject)but throws an appropriateSecurityViolationsubclass if the restriction is active.- Specified by:
checkRestrictionin interfacePolicy
-
-