yuqi1129 commented on code in PR #10996:
URL: https://github.com/apache/gravitino/pull/10996#discussion_r3280270299


##########
server-common/src/main/java/org/apache/gravitino/server/authorization/jcasbin/JcasbinAuthorizer.java:
##########
@@ -652,93 +694,202 @@ private boolean authorizeByJcasbin(
     }
   }
 
-  private static UserEntity getUserEntity(String username, String metalake) 
throws IOException {
+  // 
---------------------------------------------------------------------------
+  //  User info / ownership helpers
+  // 
---------------------------------------------------------------------------
+
+  /**
+   * Per-request {@link UserUpdatedAt} lookup. The underlying {@code 
user_meta} query is issued at
+   * most once per (metalake, username) within a single request.
+   */
+  private Optional<UserUpdatedAt> loadUserInfo(
+      String metalake, String username, AuthorizationRequestContext 
requestContext) {
+    String cacheKey = JcasbinAuthorizationCacheKeys.userRoleKey(metalake, 
username);
+    return requestContext.computeUserInfoIfAbsent(
+        cacheKey,
+        k ->
+            Optional.ofNullable(

Review Comment:
   I do not plan to cache a null value, and let me check whether the code here.



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