tengqm commented on code in PR #6515:
URL: https://github.com/apache/gravitino/pull/6515#discussion_r1970759166


##########
authorizations/authorization-ranger/src/main/java/org/apache/gravitino/authorization/ranger/RangerHelper.java:
##########
@@ -278,9 +278,18 @@ protected RangerRole createRangerRoleIfNotExists(String 
roleName, boolean isOwne
     try {
       rangerRole = rangerClient.getRole(roleName, rangerAdminName, 
rangerServiceName);
     } catch (RangerServiceException e) {
-      // ignore exception, If the role does not exist, then create it.
-      LOG.warn("The role({}) does not exist in the Ranger!", roleName);
+
+      // The client will return a error message contains `doesn't have 
permission` if the role does
+      // not exist, then create it.
+      if (e.getMessage().contains("User doesn't have permissions to get 
details")) {
+        LOG.warn("The role({}) does not exist in the Ranger!, e: {}", 
roleName, e);

Review Comment:
   IIUC, this method ensures that that a specific ranger role exists.
   If the role is not there yet, we'll create it.
   This means we may want to print an info log rather than a warning, right?
   
   If the user cannot check if a role exists or not, we still allow the 
function to continue. Does this mean that a user can create a role but he/she 
cannot view it?
   The role becomes Write-Only for him/her?
   



-- 
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]

Reply via email to