xiaoyuyao commented on a change in pull request #828: HDDS-1538. Update ozone
protobuf message for ACLs. Contributed by Ajay Kumar.
URL: https://github.com/apache/hadoop/pull/828#discussion_r285775796
##########
File path:
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/protocolPB/OMPBHelper.java
##########
@@ -98,33 +102,28 @@ public static OzoneAclInfo convertOzoneAcl(OzoneAcl acl) {
* @return OzoneAcl
*/
public static OzoneAcl convertOzoneAcl(OzoneAclInfo aclInfo) {
- OzoneAcl.OzoneACLType aclType;
+ ACLIdentityType aclType;
switch(aclInfo.getType()) {
case USER:
- aclType = OzoneAcl.OzoneACLType.USER;
+ aclType = ACLIdentityType.USER;
break;
case GROUP:
- aclType = OzoneAcl.OzoneACLType.GROUP;
+ aclType = ACLIdentityType.GROUP;
break;
case WORLD:
- aclType = OzoneAcl.OzoneACLType.WORLD;
+ aclType = ACLIdentityType.WORLD;
break;
default:
throw new IllegalArgumentException("ACL type is not recognized");
}
- OzoneAcl.OzoneACLRights aclRights;
- switch(aclInfo.getRights()) {
- case READ:
- aclRights = OzoneAcl.OzoneACLRights.READ;
- break;
- case WRITE:
- aclRights = OzoneAcl.OzoneACLRights.WRITE;
- break;
- case READ_WRITE:
- aclRights = OzoneAcl.OzoneACLRights.READ_WRITE;
- break;
- default:
- throw new IllegalArgumentException("ACL right is not recognized");
+
+ List<IAccessAuthorizer.ACLType> aclRights = new ArrayList<>();
+ for(OzoneAclRights acl:aclInfo.getRightsList()) {
+ try {
+ aclRights.add(ACLType.valueOf(acl.name()));
+ } catch(IllegalArgumentException iae) {
Review comment:
remove the try catch. Same as above.
----------------------------------------------------------------
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]