yuqi1129 commented on code in PR #6770: URL: https://github.com/apache/gravitino/pull/6770#discussion_r2022019458
########## authorizations/authorization-ranger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java: ########## @@ -734,19 +735,18 @@ public Boolean onUserAdded(User user) throws AuthorizationPluginException { @Override public Boolean onUserRemoved(User user) throws AuthorizationPluginException { - VXUserList list = rangerClient.searchUser(ImmutableMap.of("name", user.name())); - if (list.getListSize() == 0) { - LOG.warn("The user({}) doesn't exist in the Ranger!", user); + Optional<Long> userId = getUserId(user.name()); Review Comment: Since you have use `Optional`, I think we can use the following format: return userId.map(id -> { rangerClient.deleteUser(id) return True; ).orElseGet(() -> { Log.warn return false; ) -- 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: commits-unsubscr...@gravitino.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org