prashantpogde commented on a change in pull request #2826:
URL: https://github.com/apache/ozone/pull/2826#discussion_r758658736



##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/OMClientRequest.java
##########
@@ -234,15 +233,66 @@ protected void checkACLs(OzoneManager ozoneManager, 
String volumeName,
     if (ozoneManager.getAclsEnabled()) {
       String volumeOwner = ozoneManager.getVolumeOwner(obj.getVolumeName(),
           contextBuilder.getAclRights(), obj.getResourceType());
-      contextBuilder.setClientUgi(createUGI());
+      String bucketOwner = ozoneManager.getBucketOwner(obj.getVolumeName(),
+          obj.getBucketName(), contextBuilder.getAclRights(),
+          obj.getResourceType());
+      UserGroupInformation currentUser = createUGI();
+      contextBuilder.setClientUgi(currentUser);
       contextBuilder.setIp(getRemoteAddress());
       contextBuilder.setHost(getHostName());
       contextBuilder.setAclType(IAccessAuthorizer.ACLIdentityType.USER);
-      contextBuilder.setOwnerName(volumeOwner);
+
+      boolean isVolOwner = isOwner(currentUser, volumeOwner);
+      IAccessAuthorizer.ACLType parentAclRight = aclType;
+      if (isVolOwner) {
+        contextBuilder.setOwnerName(volumeOwner);
+      } else {
+        contextBuilder.setOwnerName(bucketOwner);
+      }
+      if (ozoneManager.isNativeAuthorizerEnabled()) {
+        if (aclType == IAccessAuthorizer.ACLType.CREATE ||
+                aclType == IAccessAuthorizer.ACLType.DELETE ||
+                aclType == IAccessAuthorizer.ACLType.WRITE_ACL) {
+          parentAclRight = IAccessAuthorizer.ACLType.WRITE;
+        } else if (aclType == IAccessAuthorizer.ACLType.READ_ACL ||
+                aclType == IAccessAuthorizer.ACLType.LIST) {
+          parentAclRight = IAccessAuthorizer.ACLType.READ;
+        }
+      } else {
+        parentAclRight = IAccessAuthorizer.ACLType.READ;

Review comment:
       if/else can be simplified.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to