Aias00 commented on code in PR #2341:
URL: 
https://github.com/apache/rocketmq-dashboard/pull/2341#discussion_r3801336852


##########
server/src/main/java/org/apache/rocketmq/studio/auth/AuthenticatedUserContext.java:
##########
@@ -25,24 +25,36 @@ public final class AuthenticatedUserContext {
     public static final String SYSTEM_ACTOR = "system";
 
     private static final ThreadLocal<String> CURRENT_USERNAME = new 
ThreadLocal<>();
+    private static final ThreadLocal<Boolean> CURRENT_ADMIN = new 
ThreadLocal<>();
 
     private AuthenticatedUserContext() {
     }
 
-    public static void setUsername(String username) {
+    public static void setUser(String username, boolean admin) {
         if (username == null || username.isBlank()) {
             clear();
             return;
         }
         CURRENT_USERNAME.set(username);
+        CURRENT_ADMIN.set(admin);
+    }
+
+    public static void setUsername(String username) {
+        setUser(username, false);
     }
 
     public static String currentUsernameOrSystem() {
         String username = CURRENT_USERNAME.get();
         return username == null ? SYSTEM_ACTOR : username;
     }
 
+    public static boolean currentUserIsAdminOrSystem() {

Review Comment:
   Addressed in a300e73d. Added Javadoc explaining that a missing request 
context denotes system/background work, so it intentionally retains non-reader 
access. No behavior changed.



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