You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "adoroszlai (via GitHub)" <gi...@apache.org> on 2023/05/19 12:52:56 UTC

[GitHub] [ozone] adoroszlai commented on a diff in pull request #4738: HDDS-8653. Let directory inherit bucket default ACLs

adoroszlai commented on code in PR #4738:
URL: https://github.com/apache/ozone/pull/4738#discussion_r1198920659


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMDirectoryCreateRequest.java:
##########
@@ -200,10 +199,11 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,
           omDirectoryResult == NONE) {
         List<String> missingParents = omPathInfo.getMissingParents();
         long baseObjId = ozoneManager.getObjectIdFromTxId(trxnLogIndex);
-        List<OzoneAcl> inheritAcls = omPathInfo.getAcls();
+        List<OzoneAcl> inheritAcls =

Review Comment:
   ```suggestion
           List<OzoneAcl> acls =
   ```



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMDirectoryCreateRequestWithFSO.java:
##########
@@ -172,7 +171,7 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,
             omPathInfo.getLeafNodeName(),
             keyArgs, omPathInfo.getLeafNodeObjectId(),
             omPathInfo.getLastKnownParentId(), trxnLogIndex,
-            OzoneAclUtil.fromProtobuf(keyArgs.getAclsList()));
+            inheritDefaultAcls(keyArgs, omBucketInfo.getAcls()));

Review Comment:
   If ancestor directory exists, the new directories should inherit from that ancestor instead of the bucket.  I think `omPathInfo` has the information about the ancestor or bucket in both cases.



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyRequest.java:
##########
@@ -307,6 +307,14 @@ protected List< OzoneAcl > getAclsForKey(KeyArgs keyArgs,
     return acls;
   }
 
+  protected static List<OzoneAcl> inheritDefaultAcls(KeyArgs keyArgs,
+      List<OzoneAcl> parentAcls) {
+    List<OzoneAcl> inheritAcls = new ArrayList<>();
+    inheritAcls.addAll(OzoneAclUtil.fromProtobuf(keyArgs.getAclsList()));
+    OzoneAclUtil.inheritDefaultAcls(inheritAcls, parentAcls);
+    return inheritAcls;

Review Comment:
   Can be simplified, since `OzoneAclUtil.fromProtobuf` creates a new `ArrayList` for the ACLs from `keyArgs`:
   
   ```suggestion
       List<OzoneAcl> acls = OzoneAclUtil.fromProtobuf(keyArgs.getAclsList());
       OzoneAclUtil.inheritDefaultAcls(acls, parentAcls);
       return acls;
   ```



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMDirectoryCreateRequest.java:
##########
@@ -200,10 +199,11 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,
           omDirectoryResult == NONE) {
         List<String> missingParents = omPathInfo.getMissingParents();
         long baseObjId = ozoneManager.getObjectIdFromTxId(trxnLogIndex);
-        List<OzoneAcl> inheritAcls = omPathInfo.getAcls();
+        List<OzoneAcl> inheritAcls =
+            inheritDefaultAcls(keyArgs, omPathInfo.getAcls());
 
         dirKeyInfo = createDirectoryKeyInfoWithACL(keyName, keyArgs, baseObjId,
-            OzoneAclUtil.fromProtobuf(keyArgs.getAclsList()), trxnLogIndex,
+            inheritAcls, trxnLogIndex,

Review Comment:
   ```suggestion
               acls, trxnLogIndex,
   ```



-- 
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: issues-unsubscribe@ozone.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org