public class DefaultPolicyService extends OnContextRefreshedEventListener implements PolicyService
PolicyService which is configured with all Policy instances
which are discovered in the Spring context and only focuses on a small
subset of IObject types as specified by filterObject(IObject).| Constructor and Description |
|---|
DefaultPolicyService() |
| Modifier and Type | Method and Description |
|---|---|
void |
checkRestriction(String name,
IObject obj)
Give each configured
Policy instance the chance to throw a
SecurityViolation from its
Policy.checkRestriction(IObject) method. |
protected boolean |
filterObject(IObject obj)
Limit the objects to which
Policy instances are applied. |
void |
handleContextRefreshedEvent(org.springframework.context.event.ContextRefreshedEvent event)
Loads all
Policy instances from the context,
and uses them to initialize this PolicyService. |
boolean |
isRestricted(String name,
IObject obj)
|
Set<String> |
listActiveRestrictions(IObject obj)
Return all identifier strings as would be passed as the first argument to
PolicyService.isRestricted(String, IObject) or
PolicyService.checkRestriction(String, IObject) which considers
itself active for the given argument. |
Set<String> |
listAllRestrictions()
Return all configured identifier strings as would be passed as the first
argument to
PolicyService.isRestricted(String, IObject) or
PolicyService.checkRestriction(String, IObject). |
onApplicationEvent, setApplicationContextpublic void handleContextRefreshedEvent(org.springframework.context.event.ContextRefreshedEvent event)
Policy instances from the context,
and uses them to initialize this PolicyService.handleContextRefreshedEvent in class OnContextRefreshedEventListenerpublic boolean isRestricted(String name, IObject obj)
PolicyServicePolicy instance with the given name argument
if it considers the restriction active for the given IObject
argument. If any are active, return true.isRestricted in interface PolicyServicename - non-null identifier of a class of Policy instances.obj - non-null "context" for this check.Policy returns true from
Policy.isRestricted(IObject).public void checkRestriction(String name, IObject obj)
PolicyServicePolicy instance the chance to throw a
SecurityViolation from its
Policy.checkRestriction(IObject) method.checkRestriction in interface PolicyServicename - non-null identifier of a class of Policy instances.obj - non-null "context" for this check.public Set<String> listAllRestrictions()
PolicyServicePolicyService.isRestricted(String, IObject) or
PolicyService.checkRestriction(String, IObject).listAllRestrictions in interface PolicyServicepublic Set<String> listActiveRestrictions(IObject obj)
PolicyServicePolicyService.isRestricted(String, IObject) or
PolicyService.checkRestriction(String, IObject) which considers
itself active for the given argument.listActiveRestrictions in interface PolicyServiceobj - non-null context passed to each Policy instance.Permissions.copyExtendedRestrictions()
.protected boolean filterObject(IObject obj)
Policy instances are applied. This
reduces the overhead of creating a HashSet for every object in
a returned graph.obj - e.g. the argument to listActiveRestrictions(IObject).
Version: 5.3.4-ice35-b69
Copyright © 2017 The University of Dundee & Open Microscopy Environment. All Rights Reserved.