You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/06/10 21:26:08 UTC

[GitHub] [ozone] kerneltime commented on a diff in pull request #3503: HDDS-6870 Clean up isTenantAdmin to use UGI

kerneltime commented on code in PR #3503:
URL: https://github.com/apache/ozone/pull/3503#discussion_r894900492


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/upgrade/OMFinalizeUpgradeRequest.java:
##########
@@ -66,10 +66,11 @@ public OMClientResponse validateAndUpdateCache(
     OMClientResponse response = null;
 
     try {
-      String username = getOmRequest().getUserInfo().getUserName();
-      if (ozoneManager.getAclsEnabled() && !ozoneManager.isAdmin(username)) {
-        throw new OMException("Access denied for user " + username + ". " +
-            "Superuser privilege is required to finalize upgrade.",
+      if (ozoneManager.getAclsEnabled()
+          && !ozoneManager.isAdmin(createUGI())) {
+        throw new OMException("Access denied for user "
+            + createUGI() + ". "
+            + "Superuser privilege is required to finalize upgrade.",
             OMException.ResultCodes.ACCESS_DENIED);
       }

Review Comment:
   the second call is in an exception path and the code is one less line ;-) 



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org