[ 
https://issues.apache.org/jira/browse/HDDS-1540?focusedWorklogId=251397&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-251397
 ]

ASF GitHub Bot logged work on HDDS-1540:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 30/May/19 23:14
            Start Date: 30/May/19 23:14
    Worklog Time Spent: 10m 
      Work Description: ajayydv commented on 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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 251397)
    Time Spent: 2h  (was: 1h 50m)

> Implement addAcl,removeAcl,setAcl,getAcl  for Bucket
> ----------------------------------------------------
>
>                 Key: HDDS-1540
>                 URL: https://issues.apache.org/jira/browse/HDDS-1540
>             Project: Hadoop Distributed Data Store
>          Issue Type: Sub-task
>            Reporter: Ajay Kumar
>            Assignee: Ajay Kumar
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> Implement addAcl,removeAcl,setAcl,getAcl  for Bucket



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to