HDDS-1885. Fix bug in checkAcls in OzoneManager. (#1199)

This commit is contained in:
Bharat Viswanadham 2019-07-31 19:00:37 -07:00 committed by GitHub
parent b008072044
commit c1f74405d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 5 deletions

View File

@ -1801,17 +1801,16 @@ public final class OzoneManager extends ServiceRuntimeInfoImpl
.setVolumeName(vol)
.setBucketName(bucket)
.setKeyName(key).build();
UserGroupInformation user = ProtobufRpcEngine.Server.getRemoteUser();
RequestContext context = RequestContext.newBuilder()
.setClientUgi(user)
.setIp(ProtobufRpcEngine.Server.getRemoteIp())
.setClientUgi(ugi)
.setIp(remoteAddress)
.setAclType(ACLIdentityType.USER)
.setAclRights(aclType)
.build();
if (!accessAuthorizer.checkAccess(obj, context)) {
LOG.warn("User {} doesn't have {} permission to access {}",
user.getUserName(), aclType, resType);
throw new OMException("User " + user.getUserName() + " doesn't " +
ugi.getUserName(), aclType, resType);
throw new OMException("User " + ugi.getUserName() + " doesn't " +
"have " + aclType + " permission to access " + resType,
ResultCodes.PERMISSION_DENIED);
}