hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [hadoop] ajayydv commented on a change in pull request #874: HDDS-1540. Implement addAcl, removeAcl, setAcl, getAcl for Bucket. Contributed by Ajay Kumar.
Date Thu, 30 May 2019 23:14:01 GMT
ajayydv commented on a change in pull request #874: HDDS-1540. Implement addAcl,removeAcl,setAcl,getAcl
for Bucket. Contributed by Ajay Kumar.
URL: https://github.com/apache/hadoop/pull/874#discussion_r289207003
 
 

 ##########
 File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/BucketManagerImpl.java
 ##########
 @@ -423,4 +428,205 @@ private void commitDeleteBucketInfoToOMDB(String dbBucketKey)
         volumeName, startBucket, bucketPrefix, maxNumOfBuckets);
 
   }
+
+  /**
+   * Add acl for Ozone object. Return true if acl is added successfully else
+   * false.
+   *
+   * @param obj Ozone object for which acl should be added.
+   * @param acl ozone acl top be added.
+   * @throws IOException if there is error.
+   */
+  @Override
+  public boolean addAcl(OzoneObj obj, OzoneAcl acl) throws IOException {
+    Objects.requireNonNull(obj);
+    Objects.requireNonNull(acl);
+    if (!obj.getResourceType().equals(OzoneObj.ResourceType.BUCKET)) {
+      throw new IllegalArgumentException("Unexpected argument passed to " +
+          "BucketManager. OzoneObj type:" + obj.getResourceType());
+    }
+    String volume = obj.getVolumeName();
+    String bucket = obj.getBucketName();
+    metadataManager.getLock().acquireBucketLock(volume, bucket);
+    try {
+      String dbBucketKey = metadataManager.getBucketKey(volume, bucket);
+      OmBucketInfo bucketInfo =
+          metadataManager.getBucketTable().get(dbBucketKey);
+      if (bucketInfo == null) {
+        LOG.debug("Bucket:{}/{} does not exist", volume, bucket);
+        throw new OMException("Bucket " + bucket + " is not found",
+            BUCKET_NOT_FOUND);
+      }
+      List<OzoneAcl> list = bucketInfo.getAcls();
+      list.add(acl);
 
 Review comment:
   added a static function in new interface to check for existing duplicate acls, we can add
more rules when we add dacls.

----------------------------------------------------------------
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: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Mime
View raw message