예제 #1
0
 @Override
 public PolicyResponse processPostQuery(Result input, Map<String, Serializable> properties)
     throws StopProcessingException {
   HashMap<String, Set<String>> itemPolicy = new HashMap<>();
   Metacard metacard = input.getMetacard();
   if (metacard.getTags().contains(RegistryConstants.REGISTRY_TAG)) {
     if ((whiteList && !registryEntryIds.contains(metacard.getId()))
         || (!whiteList && registryEntryIds.contains(metacard.getId()))) {
       itemPolicy.putAll(bypassAccessPolicy);
     } else {
       itemPolicy.putAll(readAccessPolicy);
     }
   }
   return new PolicyResponseImpl(new HashMap<>(), itemPolicy);
 }
예제 #2
0
 private PolicyResponse getWritePolicy(Metacard input, Map<String, Serializable> properties) {
   HashMap<String, Set<String>> operationPolicy = new HashMap<>();
   if (Requests.isLocal(properties) && input.getTags().contains(RegistryConstants.REGISTRY_TAG)) {
     Attribute attribute = input.getAttribute(RegistryObjectMetacardType.REGISTRY_BASE_URL);
     if (isRegistryDisabled()
         || (attribute != null
             && attribute.getValue() instanceof String
             && ((String) attribute.getValue()).startsWith(SystemBaseUrl.getBaseUrl()))) {
       operationPolicy.putAll(bypassAccessPolicy);
     } else {
       operationPolicy.putAll(writeAccessPolicy);
     }
   }
   return new PolicyResponseImpl(operationPolicy, new HashMap<>());
 }