ChenSammi commented on code in PR #4439:
URL: https://github.com/apache/ozone/pull/4439#discussion_r1144230432
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketSetPropertyRequest.java:
##########
@@ -269,6 +268,26 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager,
}
}
+ private void checkAclPermission(
+ OzoneManager ozoneManager, String volumeName, String bucketName)
+ throws IOException {
+ if (ozoneManager.getOmMetadataReader().isNativeAuthorizerEnabled()) {
+ UserGroupInformation ugi = createUGI();
+ String bucketOwner = ozoneManager.getBucketOwner(volumeName, bucketName,
+ IAccessAuthorizer.ACLType.READ, OzoneObj.ResourceType.BUCKET);
+ if (!ozoneManager.isAdmin(ugi) &&
+ !ozoneManager.isOwner(ugi, bucketOwner)) {
+ throw new OMException(
+ "Only bucket owners and Ozone admins can set Bucket property",
Review Comment:
We should change the title, for example "Bucket properties are allowed to
changed by Admin or Owner only".
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketSetPropertyRequest.java:
##########
@@ -269,6 +268,26 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager,
}
}
+ private void checkAclPermission(
+ OzoneManager ozoneManager, String volumeName, String bucketName)
+ throws IOException {
+ if (ozoneManager.getOmMetadataReader().isNativeAuthorizerEnabled()) {
+ UserGroupInformation ugi = createUGI();
+ String bucketOwner = ozoneManager.getBucketOwner(volumeName, bucketName,
+ IAccessAuthorizer.ACLType.READ, OzoneObj.ResourceType.BUCKET);
+ if (!ozoneManager.isAdmin(ugi) &&
+ !ozoneManager.isOwner(ugi, bucketOwner)) {
+ throw new OMException(
+ "Only bucket owners and Ozone admins can set Bucket property",
Review Comment:
We should change the title, for example "Bucket properties are allowed to
changed by Admin and
Owner only".
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]