slfan1989 commented on code in PR #7824:
URL: https://github.com/apache/hadoop/pull/7824#discussion_r2226977540


##########
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsWebServices.java:
##########
@@ -127,8 +130,22 @@ private void checkAccess(Job job, HttpServletRequest 
request) {
     }
   }
   private void checkAccess(String containerIdStr, HttpServletRequest hsr) {
-    if (mrAclsEnabled) {
-      checkAccess(AMWebServices.getJobFromContainerIdString(containerIdStr, 
ctx), hsr);
+    // Apply MR ACLs only if the container belongs to a MapReduce job.
+    // For non-MapReduce jobs, no corresponding Job will be found,
+    // so ACLs are not enforced.
+    if (mrAclsEnabled && isMRJobContainer(containerIdStr)) {
+      Job job = AMWebServices.getJobFromContainerIdString(containerIdStr, ctx);
+      checkAccess(job, hsr);
+    }
+  }
+
+  private boolean isMRJobContainer(String containerIdStr) {
+    try {
+      AMWebServices.getJobFromContainerIdString(containerIdStr, ctx);
+      return true;
+    } catch (NotFoundException e) {
+      LOG.trace("Container " + containerIdStr + " does not belong to a 
MapReduce job");
+      return false;

Review Comment:
   LOG.trace("Container {} does not belong to a MapReduce job", containerIdStr);



-- 
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.

To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to