xiaoyuyao commented on a change in pull request #1074: HDDS-1544. Support
default Acls for volume, bucket, keys and prefix. Contributed by Ajay Kumar.
URL: https://github.com/apache/hadoop/pull/1074#discussion_r302681915
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/PrefixManagerImpl.java
##########
@@ -230,11 +231,25 @@ public boolean setAcl(OzoneObj obj, List<OzoneAcl> acls)
throws IOException {
OmPrefixInfo prefixInfo =
metadataManager.getPrefixTable().get(prefixPath);
OmPrefixInfo.Builder upiBuilder = OmPrefixInfo.newBuilder();
- upiBuilder.setName(prefixPath).setAcls(acls);
+ List<OzoneAcl> aclsToBeSet = new ArrayList<>(acls.size());
+ aclsToBeSet.addAll(acls);
+ upiBuilder.setName(prefixPath);
if (prefixInfo != null && prefixInfo.getMetadata() != null) {
upiBuilder.addAllMetadata(prefixInfo.getMetadata());
}
- prefixInfo = upiBuilder.build();
+ String bucketKey = metadataManager.getBucketKey(obj.getVolumeName(),
+ obj.getBucketName());
+ OmBucketInfo bucketInfo = metadataManager.getBucketTable().
+ get(bucketKey);
+ if(bucketInfo != null) {
+ bucketInfo.getAcls().forEach(a -> {
+ if (a.getAclScope().equals(OzoneAcl.AclScope.DEFAULT)) {
+ aclsToBeSet.add(new OzoneAcl(a.getType(), a.getName(),
+ a.getAclBitSet(), OzoneAcl.AclScope.ACCESS));
+ }
+ });
+ }
Review comment:
This handles inheritance of default acls form bucket. What if there are
default acls from the parents of prefix tree path?
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]