[ 
https://issues.apache.org/jira/browse/GOBBLIN-1050?focusedWorklogId=394501&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-394501
 ]

ASF GitHub Bot logged work on GOBBLIN-1050:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 27/Feb/20 22:15
            Start Date: 27/Feb/20 22:15
    Worklog Time Spent: 10m 
      Work Description: jack-moseley commented on 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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 394501)
    Time Spent: 1h 10m  (was: 1h)

> Verify requester when updating/deleting FlowConfig
> --------------------------------------------------
>
>                 Key: GOBBLIN-1050
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1050
>             Project: Apache Gobblin
>          Issue Type: Improvement
>            Reporter: Jack Moseley
>            Priority: Major
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to