use of ddf.catalog.plugin.PolicyPlugin in project ddf by codice.
the class ResourceOperations method processPreResourcePolicyPlugins.
private ResourceRequest processPreResourcePolicyPlugins(ResourceRequest resourceReq) throws StopProcessingException {
HashMap<String, Set<String>> requestPolicyMap = new HashMap<>();
for (PolicyPlugin plugin : frameworkProperties.getPolicyPlugins()) {
PolicyResponse policyResponse = plugin.processPreResource(resourceReq);
opsSecuritySupport.buildPolicyMap(requestPolicyMap, policyResponse.operationPolicy().entrySet());
}
resourceReq.getProperties().put(PolicyPlugin.OPERATION_SECURITY, requestPolicyMap);
return resourceReq;
}
use of ddf.catalog.plugin.PolicyPlugin in project ddf by codice.
the class DeleteOperations method processPreDeletePolicyPlugins.
private DeleteRequest processPreDeletePolicyPlugins(DeleteRequest deleteRequest) throws StopProcessingException {
List<Metacard> metacards = getDeleteMetacards(deleteRequest);
Map<String, Serializable> unmodifiableProperties = Collections.unmodifiableMap(deleteRequest.getProperties());
HashMap<String, Set<String>> requestPolicyMap = new HashMap<>();
for (PolicyPlugin plugin : frameworkProperties.getPolicyPlugins()) {
PolicyResponse policyResponse = plugin.processPreDelete(metacards, unmodifiableProperties);
opsSecuritySupport.buildPolicyMap(requestPolicyMap, policyResponse.operationPolicy().entrySet());
}
deleteRequest.getProperties().put(PolicyPlugin.OPERATION_SECURITY, requestPolicyMap);
return deleteRequest;
}
use of ddf.catalog.plugin.PolicyPlugin in project ddf by codice.
the class CreateOperations method updateCreateRequestPolicyMap.
private CreateRequest updateCreateRequestPolicyMap(CreateRequest createRequest) throws StopProcessingException {
Map<String, Serializable> unmodifiablePropertiesMap = Collections.unmodifiableMap(createRequest.getProperties());
HashMap<String, Set<String>> requestPolicyMap = new HashMap<>();
for (Metacard metacard : createRequest.getMetacards()) {
HashMap<String, Set<String>> itemPolicyMap = new HashMap<>();
for (PolicyPlugin plugin : frameworkProperties.getPolicyPlugins()) {
PolicyResponse policyResponse = plugin.processPreCreate(metacard, unmodifiablePropertiesMap);
opsSecuritySupport.buildPolicyMap(itemPolicyMap, policyResponse.itemPolicy().entrySet());
opsSecuritySupport.buildPolicyMap(requestPolicyMap, policyResponse.operationPolicy().entrySet());
}
metacard.setAttribute(new AttributeImpl(Metacard.SECURITY, itemPolicyMap));
}
createRequest.getProperties().put(PolicyPlugin.OPERATION_SECURITY, requestPolicyMap);
return createRequest;
}
Aggregations