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 forPolicy
implementations 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 void
checkRestriction(ome.model.IObject obj)
LikePolicy.isRestricted(IObject)
but throws an appropriateSecurityViolation
subclass if the restriction is active.abstract java.lang.String
getName()
Unique name for a class of restrictions that thisPolicy
will enforce.java.util.Set<java.lang.Class<ome.model.IObject>>
getTypes()
boolean
isRestricted(ome.model.IObject obj)
Checks whether or not this instance would throw aSecurityViolation
if the same instance were passed toPolicy.checkRestriction(IObject)
.
-
-
-
Method Detail
-
getName
public abstract java.lang.String getName()
Description copied from interface:Policy
Unique name for a class of restrictions that thisPolicy
will 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:Policy
EachPolicy
should tell thePolicyService
which types ofIObject
instances it cares about. Only those which are of interest to somePolicy
need be considered.
-
isRestricted
public boolean isRestricted(ome.model.IObject obj)
Description copied from interface:Policy
Checks whether or not this instance would throw aSecurityViolation
if the same instance were passed toPolicy.checkRestriction(IObject)
. This is likely determined by first testing the type of theIObject
and then that the current user context has access to the given context.- Specified by:
isRestricted
in interfacePolicy
- Parameters:
obj
- a non-nullIObject
instance.- Returns:
- true if this
Policy
decides that a restriction should be placed on the passed context.
-
checkRestriction
public void checkRestriction(ome.model.IObject obj)
Description copied from interface:Policy
LikePolicy.isRestricted(IObject)
but throws an appropriateSecurityViolation
subclass if the restriction is active.- Specified by:
checkRestriction
in interfacePolicy
-
-