You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/04/01 10:30:51 UTC

[GitHub] [hadoop-ozone] lokeshj1703 commented on a change in pull request #683: HDDS-3149. Make o3fs support set and get acl

lokeshj1703 commented on a change in pull request #683: HDDS-3149. Make o3fs support set and get acl
URL: https://github.com/apache/hadoop-ozone/pull/683#discussion_r401514057
 
 

 ##########
 File path: hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneFileSystem.java
 ##########
 @@ -703,6 +710,78 @@ 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.getAcl(pathToKey(path));
+    String userAcls =
+        JsonUtils.toJsonStringWithDefaultPrettyPrinter(
+            ozoneAcls.get(ACLIdentityType.USER.toString()));
+    String groupAcls =
+        JsonUtils.toJsonStringWithDefaultPrettyPrinter(
+            ozoneAcls.get(ACLIdentityType.GROUP.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 {
+    adapter.setAcl(pathToKey(path), aclSpecToString(aclSpec));
+  }
+
+  public String toAclString(AclEntry aclEntry) {
 
 Review comment:
   I think we are converting AclEntry to form which can be parsed by OzoneAcl. Would it make sense to move this function to OzoneAcl class?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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