Package ome.security.policy
Interface PolicyService
-
- All Known Implementing Classes:
DefaultPolicyService
public interface PolicyServiceInternal service containing a number of configuredPolicyinstances. EachPolicyis stored under a unique name, for which there may be several otherPolicyinstances. Consumers can either check whether such a policy restriction is active viaisRestricted(String, IObject)or let an exception be thrown by thePolicyitself 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 voidcheckRestriction(java.lang.String name, ome.model.IObject obj)Give each configuredPolicyinstance the chance to throw aSecurityViolationfrom itsPolicy.checkRestriction(IObject)method.booleanisRestricted(java.lang.String name, ome.model.IObject obj)Ask each configuredPolicyinstance with the given name argument if it considers the restriction active for the givenIObjectargument.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 configuredPolicyinstance with the given name argument if it considers the restriction active for the givenIObjectargument. If any are active, return true.- Parameters:
name- non-null identifier of a class ofPolicyinstances.obj- non-null "context" for this check.- Returns:
- true if any
Policyreturns true fromPolicy.isRestricted(IObject).
-
checkRestriction
void checkRestriction(java.lang.String name, ome.model.IObject obj) throws ome.conditions.SecurityViolationGive each configuredPolicyinstance the chance to throw aSecurityViolationfrom itsPolicy.checkRestriction(IObject)method.- Parameters:
name- non-null identifier of a class ofPolicyinstances.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 eachPolicyinstance.- Returns:
- a possibly empty string set of identifiers which should be
returned to clients via
Permissions.copyExtendedRestrictions().
-
-