lokeshj1703 commented on a change in pull request #683:
URL: https://github.com/apache/hadoop-ozone/pull/683#discussion_r412828038



##########
File path: 
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OzoneAcl.java
##########
@@ -340,4 +342,37 @@ public OzoneAcl setAclScope(AclScope scope) {
     ACCESS,
     DEFAULT;
   }
+
+  public String toAclString(AclEntry aclEntry) {

Review comment:
       Can we add documentation for these functions that String returned can be 
parsed using OzoneAcl#parseAcl?

##########
File path: 
hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneFileSystem.java
##########
@@ -703,6 +708,43 @@ public String toString() {
         + "}";
   }
 
+  /**
+   * Gets the ACL of a key.
+   *
+   * @param path Path to get
+   * @return AclStatus describing the ACL of the key
+   * @throws IOException if an ACL could not be read
+   * @throws UnsupportedOperationException if the operation is unsupported
+   *         (default outcome).
+   */
+  @Override
+  public AclStatus getAclStatus(Path path) throws IOException {
+    Map<String, List<OzoneAcl>> ozoneAcls = adapter.getAcls(pathToKey(path));
+    String userAcls =
+        ozoneAcls.get(ACLIdentityType.USER.toString()).toString();
+    String groupAcls =
+        ozoneAcls.get(ACLIdentityType.GROUP.toString()).toString();
+    return new AclStatus.Builder()
+            .owner(userAcls)
+            .group(groupAcls)
+            .build();
+  }
+
+  /**
+   * Fully replaces ACL of a key, discarding all existing entries.
+   *
+   * @param path Path to modify
+   * @param aclSpec List describing modifications, which must include entries
+   *   for user, group for compatibility with permission bits.
+   * @throws IOException if an ACL could not be modified
+   * @throws UnsupportedOperationException if the operation is unsupported
+   *         (default outcome).
+   */
+  @Override
+  public void setAcl(Path path, List<AclEntry> aclSpec) throws IOException {

Review comment:
       The AclEntry can be of type MASK, OTHER. I think we should map these 
into OzoneAcl as well, but dont know the correct mapping here. cc @xiaoyuyao 

##########
File path: 
hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java
##########
@@ -322,6 +330,38 @@ public void makeQualified(FileStatus status, URI uri, Path 
path,
     return new IteratorAdapter(bucket.listKeys(pathKey));
   }
 
+  @Override
+  public Map<String, List<OzoneAcl>> getAcls(String keyName)
+      throws IOException {
+    OzoneObj obj = OzoneObjInfo.Builder.newBuilder()
+        .setBucketName(bucket.getName()).setVolumeName(volume.getName())
+        .setKeyName(keyName).setResType(OzoneObj.ResourceType.KEY)
+        .setStoreType(OZONE).build();
+    List<OzoneAcl> userResult = new ArrayList<OzoneAcl>();
+    List<OzoneAcl> groupResult = new ArrayList<OzoneAcl>();
+
+    ozoneClient.getObjectStore().getAcl(obj).forEach(ozoneAcl -> {
+      if (ozoneAcl.getType().equals(ACLIdentityType.USER)) {
+        userResult.add(ozoneAcl);
+      } else if (ozoneAcl.getType().equals(ACLIdentityType.GROUP)) {

Review comment:
       Sorry for identifying this late, do we also need to check the other 
ACLIdentityType here like ACLIdentityType.WORLD etc.?




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



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

Reply via email to