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(java.lang.String name,
                IObject obj)Give each configured  Policyinstance the chance to throw aSecurityViolationfrom itsPolicy.checkRestriction(IObject)method. | 
| protected boolean | filterObject(IObject obj)Limit the objects to which  Policyinstances are applied. | 
| void | handleContextRefreshedEvent(org.springframework.context.event.ContextRefreshedEvent event)Loads all  Policyinstances from the context,
 and uses them to initialize thisPolicyService. | 
| boolean | isRestricted(java.lang.String name,
            IObject obj) | 
| java.util.Set<java.lang.String> | listActiveRestrictions(IObject obj)Return all identifier strings as would be passed as the first argument to
  PolicyService.isRestricted(String, IObject)orPolicyService.checkRestriction(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 to  PolicyService.isRestricted(String, IObject)orPolicyService.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(java.lang.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(java.lang.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 java.util.Set<java.lang.String> listAllRestrictions()
PolicyServicePolicyService.isRestricted(String, IObject) or
 PolicyService.checkRestriction(String, IObject).listAllRestrictions in interface PolicyServicepublic java.util.Set<java.lang.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.4.4-ice35-b82
Copyright © 2018 The University of Dundee & Open Microscopy Environment. All Rights Reserved.