Package ome.security.policy
Interface PolicyService
-
- All Known Implementing Classes:
DefaultPolicyService
public interface PolicyService
Internal service containing a number of configuredPolicy
instances. EachPolicy
is stored under a unique name, for which there may be several otherPolicy
instances. Consumers can either check whether such a policy restriction is active viaisRestricted(String, IObject)
or let an exception be thrown by thePolicy
itself viacheckRestriction(String, IObject)
. Further, the list of currently active restrictions can be provided in bulk to clients vialistActiveRestrictions(IObject)
so that restricted operations need not be called only to have an exception thrown.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
checkRestriction(java.lang.String name, ome.model.IObject obj)
Give each configuredPolicy
instance the chance to throw aSecurityViolation
from itsPolicy.checkRestriction(IObject)
method.boolean
isRestricted(java.lang.String name, ome.model.IObject obj)
Ask each configuredPolicy
instance with the given name argument if it considers the restriction active for the givenIObject
argument.java.util.Set<java.lang.String>
listActiveRestrictions(ome.model.IObject obj)
Return all identifier strings as would be passed as the first argument toisRestricted(String, IObject)
orcheckRestriction(String, IObject)
which considers itself active for the given argument.java.util.Set<java.lang.String>
listAllRestrictions()
Return all configured identifier strings as would be passed as the first argument toisRestricted(String, IObject)
orcheckRestriction(String, IObject)
.
-
-
-
Method Detail
-
isRestricted
boolean isRestricted(java.lang.String name, ome.model.IObject obj)
Ask each configuredPolicy
instance with the given name argument if it considers the restriction active for the givenIObject
argument. If any are active, return true.- Parameters:
name
- non-null identifier of a class ofPolicy
instances.obj
- non-null "context" for this check.- Returns:
- true if any
Policy
returns true fromPolicy.isRestricted(IObject)
.
-
checkRestriction
void checkRestriction(java.lang.String name, ome.model.IObject obj) throws ome.conditions.SecurityViolation
Give each configuredPolicy
instance the chance to throw aSecurityViolation
from itsPolicy.checkRestriction(IObject)
method.- Parameters:
name
- non-null identifier of a class ofPolicy
instances.obj
- non-null "context" for this check.- Throws:
ome.conditions.SecurityViolation
-
listAllRestrictions
java.util.Set<java.lang.String> listAllRestrictions()
Return all configured identifier strings as would be passed as the first argument toisRestricted(String, IObject)
orcheckRestriction(String, IObject)
.
-
listActiveRestrictions
java.util.Set<java.lang.String> listActiveRestrictions(ome.model.IObject obj)
Return all identifier strings as would be passed as the first argument toisRestricted(String, IObject)
orcheckRestriction(String, IObject)
which considers itself active for the given argument.- Parameters:
obj
- non-null context passed to eachPolicy
instance.- Returns:
- a possibly empty string set of identifiers which should be
returned to clients via
Permissions.copyExtendedRestrictions()
.
-
-