public abstract class BasePolicy extends java.lang.Object implements Policy
Policy
implementations which always returns
true for isRestricted(IObject)
and always fails on
checkRestriction(IObject)
.Modifier and Type | Field and Description |
---|---|
protected java.util.Set<java.lang.Class<IObject>> |
types |
Constructor and Description |
---|
BasePolicy(java.util.Set<java.lang.Class<IObject>> types) |
Modifier and Type | Method and Description |
---|---|
void |
checkRestriction(IObject obj)
Like
Policy.isRestricted(IObject) but throws an appropriate
SecurityViolation subclass if the restriction is active. |
abstract java.lang.String |
getName()
Unique name for a class of restrictions that this
Policy
will enforce. |
java.util.Set<java.lang.Class<IObject>> |
getTypes()
|
boolean |
isRestricted(IObject obj)
Checks whether or not this instance would throw a
SecurityViolation if the same instance were passed to
Policy.checkRestriction(IObject) . |
protected final java.util.Set<java.lang.Class<IObject>> types
public BasePolicy(java.util.Set<java.lang.Class<IObject>> types)
public abstract java.lang.String getName()
Policy
Policy
will enforce. This string will be sent to clients via
Permissions.copyExtendedRestrictions()
in
order to prevent exceptions, and server-code will pass the same name
to the check method to potentially have an exception thrown.public java.util.Set<java.lang.Class<IObject>> getTypes()
Policy
Policy
should tell the PolicyService
which types
of IObject
instances it cares about. Only those which are of
interest to some Policy
need be considered.public boolean isRestricted(IObject obj)
Policy
SecurityViolation
if the same instance were passed to
Policy.checkRestriction(IObject)
. This is likely determined by first
testing the type of the IObject
and then that the
current user context has access to the given context.isRestricted
in interface Policy
obj
- a non-null IObject
instance.Policy
decides that a restriction should be
placed on the passed context.public void checkRestriction(IObject obj)
Policy
Policy.isRestricted(IObject)
but throws an appropriate
SecurityViolation
subclass if the restriction is active.checkRestriction
in interface Policy
Version: 5.4.6-ice35-b87
Copyright © 2018 The University of Dundee & Open Microscopy Environment. All Rights Reserved.