public interface Policy
Policy
class with a unique name
and 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 }
Modifier and Type | Method and Description |
---|---|
void |
checkRestriction(IObject obj)
Like
isRestricted(IObject) but throws an appropriate
SecurityViolation subclass if the restriction is active. |
String |
getName()
Unique name for a class of restrictions that this
Policy
will enforce. |
Set<Class<IObject>> |
getTypes()
|
boolean |
isRestricted(IObject obj)
Checks whether or not this instance would throw a
SecurityViolation if the same instance were passed to
checkRestriction(IObject) . |
String getName()
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.Set<Class<IObject>> getTypes()
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.boolean isRestricted(IObject obj)
SecurityViolation
if the same instance were passed to
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.void checkRestriction(IObject obj) throws SecurityViolation
isRestricted(IObject)
but throws an appropriate
SecurityViolation
subclass if the restriction is active.SecurityViolation
Version: 5.2.0-ice35-b12
Copyright © 2015 The University of Dundee & Open Microscopy Environment. All Rights Reserved.