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

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

                Author: ASF GitHub Bot
            Created on: 04/Jun/19 18:55
            Start Date: 04/Jun/19 18:55
    Worklog Time Spent: 10m 
      Work Description: xiaoyuyao commented on pull request #885: HDDS-1541. 
Implement addAcl,removeAcl,setAcl,getAcl for Key. Contributed by Ajay Kumat.
URL: https://github.com/apache/hadoop/pull/885#discussion_r290445584
 
 

 ##########
 File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/BucketManagerImpl.java
 ##########
 @@ -404,27 +407,44 @@ public boolean addAcl(OzoneObj obj, OzoneAcl acl) throws 
IOException {
         throw new OMException("Bucket " + bucket + " is not found",
             BUCKET_NOT_FOUND);
       }
-      List<OzoneAcl> list = bucketInfo.getAcls();
-      if(!validateAddAcl(acl, list)) {
-        // New acl can't be added as it is not consistent with existing ACLs.
-        LOG.info("New acl:{} can't be added as it is not consistent with " +
-            "existing ACLs:{}.", acl, StringUtils.join(",", list));
-        return false;
+
+      // Case 1: When we are adding more rights to existing user/group.
+      boolean addToExistingAcl = false;
+      for(OzoneAcl a: bucketInfo.getAcls()) {
+        if(a.getName().equals(acl.getName()) &&
+            a.getType().equals(acl.getType())) {
+          BitSet bits = (BitSet) acl.getAclBitSet().clone();
+          bits.or(a.getAclBitSet());
+
+          if (bits.equals(a.getAclBitSet())) {
+            return false;
+          }
+          a.getAclBitSet().or(acl.getAclBitSet());
+          addToExistingAcl = true;
 
 Review comment:
   if we return true here, the boolean addToExistingAcl can be eliminated. 
 
----------------------------------------------------------------
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: 253950)
    Time Spent: 80h  (was: 79h 50m)

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



--
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