rakeshadr commented on a change in pull request #2008:
URL: https://github.com/apache/ozone/pull/2008#discussion_r599241382
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/OMClientRequest.java
##########
@@ -186,6 +189,64 @@ public void checkAcls(OzoneManager ozoneManager,
ozoneManager.getVolumeOwner(vol, aclType, resType));
}
+ /**
+ * Check Acls for the ozone key.
+ * @param ozoneManager
+ * @param obj
+ * @param ctxtBuilder
+ * @throws IOException
+ */
+ protected void checkKeyAcls(OzoneManager ozoneManager, OzoneObj obj,
+ RequestContext.Builder ctxtBuilder)
+ throws IOException {
+
+ if (ozoneManager.getAclsEnabled()) {
+ String volumeOwner = ozoneManager.getVolumeOwner(obj.getVolumeName(),
+ ctxtBuilder.getAclRights(), obj.getResourceType());
+ ctxtBuilder.setClientUgi(createUGI());
+ ctxtBuilder.setIp(getRemoteAddress());
+ ctxtBuilder.setHost(getHostName());
+ ctxtBuilder.setAclType(IAccessAuthorizer.ACLIdentityType.USER);
+ ctxtBuilder.setOwnerName(volumeOwner);
+ ozoneManager.checkAcls(obj, ctxtBuilder.build(), true);
+ }
+ }
+
+ /**
+ * Check Acls for the ozone key.
+ * @param ozoneManager
+ * @param volumeName
+ * @param bucketName
+ * @param keyName
+ * @throws IOException
+ */
+ protected void checkACLs(OzoneManager ozoneManager, String volumeName,
+ String bucketName, String keyName) throws IOException {
+
+ // TODO: Presently not populating sub-paths under a single bucket
+ // lock. Need to revisit this to handle any concurrent operations
+ // along with this.
+ OzonePrefixPathImpl pathViewer = new OzonePrefixPathImpl(volumeName,
+ bucketName, keyName, ozoneManager.getKeyManager());
+
+ OzoneObj obj = OzoneObjInfo.Builder.newBuilder()
+ .setResType(OzoneObj.ResourceType.KEY)
+ .setStoreType(OzoneObj.StoreType.OZONE)
+ .setVolumeName(volumeName)
+ .setBucketName(bucketName)
+ .setKeyName(keyName)
+ .setOzonePrefixPath(pathViewer).build();
+
+ boolean isDirectory = pathViewer.getOzoneFileStatus().isDirectory();
+
+ RequestContext.Builder contextBuilder = RequestContext.newBuilder()
+ .setAclRights(IAccessAuthorizer.ACLType.DELETE)
Review comment:
Sure, will pass `ACLType` as an argument to this function and will make
it generic.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]