You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gobblin.apache.org by GitBox <gi...@apache.org> on 2020/02/27 22:15:52 UTC

[GitHub] [incubator-gobblin] jack-moseley commented on a change in pull request #2890: [GOBBLIN-1050] Verify requester when updating/deleting FlowConfig

jack-moseley commented on a change in pull request #2890: [GOBBLIN-1050] Verify requester when updating/deleting FlowConfig
URL: https://github.com/apache/incubator-gobblin/pull/2890#discussion_r385403224
 
 

 ##########
 File path: gobblin-restli/gobblin-flow-config-service/gobblin-flow-config-service-server/src/main/java/org/apache/gobblin/service/FlowConfigsResource.java
 ##########
 @@ -124,12 +124,38 @@ public UpdateResponse update(ComplexResourceKey<FlowId, EmptyRecord> key, FlowCo
    */
   @Override
   public UpdateResponse delete(ComplexResourceKey<FlowId, EmptyRecord> key) {
+    checkRequester(get(key), this.requesterService.findRequesters(this));
     String flowGroup = key.getKey().getFlowGroup();
     String flowName = key.getKey().getFlowName();
     FlowId flowId = new FlowId().setFlowGroup(flowGroup).setFlowName(flowName);
     return this.flowConfigsResourceHandler.deleteFlowConfig(flowId, getHeaders());
   }
 
+  /**
+   * Check that all {@link ServiceRequester}s in this request are contained within the original service requester list
+   * when the flow was submitted and throw a {@link FlowConfigLoggedException} if they are not.
+   *
+   * @param originalFlowConfig original flow config to find original requester
+   * @param requesterList list of requesters for this request
+   */
+  public static void checkRequester(FlowConfig originalFlowConfig, List<ServiceRequester> requesterList) {
 
 Review comment:
   I think I still prefer throwing exception in the method to avoid having to copy the throwing exception code to five places. I updated the javadoc to make the exceptions thrown more clear.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services