This is an automated email from the ASF dual-hosted git repository.

lizhimins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
     new a138fc6ff fix(tencent): match a partial principal in the ACL rule 
search (#5906)
a138fc6ff is described below

commit a138fc6fffc2bc7439eb7b1257a412f44564c8c5
Author: 烤化の初雪 <[email protected]>
AuthorDate: Fri Nov 27 12:19:11 2026 +0800

    fix(tencent): match a partial principal in the ACL rule search (#5906)
---
 .../studio/provider/tencent/TencentAclService.java       | 10 ++++++++--
 .../studio/provider/tencent/TencentAclServiceTest.java   | 16 ++++++++++++++++
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git 
a/server/src/main/java/org/apache/rocketmq/studio/provider/tencent/TencentAclService.java
 
b/server/src/main/java/org/apache/rocketmq/studio/provider/tencent/TencentAclService.java
index cf2f5b896..08a675202 100644
--- 
a/server/src/main/java/org/apache/rocketmq/studio/provider/tencent/TencentAclService.java
+++ 
b/server/src/main/java/org/apache/rocketmq/studio/provider/tencent/TencentAclService.java
@@ -37,6 +37,7 @@ import java.time.LocalDateTime;
 import java.time.ZoneId;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Locale;
 
 /**
  * Maps Tencent Cloud TDMQ RocketMQ 5.x role management (DescribeRoleList / 
CreateRole /
@@ -114,8 +115,13 @@ public class TencentAclService {
                         && !Boolean.TRUE.equals(role.getPermWrite())) {
                     continue;
                 }
-                if (requestedPrincipal != null
-                        && !requestedPrincipal.equals(role.getRoleName())) {
+                // The console's principal box is a search field (the 
acl.searchPrincipal label),
+                // and the sibling filters in this feature match substrings: 
the resource filter
+                // uses containsIgnoreCase and the Apache path filters the 
principal with SQL LIKE.
+                // An exact comparison made every partial principal return an 
empty page.
+                if (StringUtils.hasText(requestedPrincipal)
+                        && !role.getRoleName().toLowerCase(Locale.ROOT)
+                                
.contains(requestedPrincipal.toLowerCase(Locale.ROOT))) {
                     continue;
                 }
                 rules.add(toRule(role));
diff --git 
a/server/src/test/java/org/apache/rocketmq/studio/provider/tencent/TencentAclServiceTest.java
 
b/server/src/test/java/org/apache/rocketmq/studio/provider/tencent/TencentAclServiceTest.java
index 152242b4e..00d31ae6d 100644
--- 
a/server/src/test/java/org/apache/rocketmq/studio/provider/tencent/TencentAclServiceTest.java
+++ 
b/server/src/test/java/org/apache/rocketmq/studio/provider/tencent/TencentAclServiceTest.java
@@ -384,6 +384,22 @@ class TencentAclServiceTest {
                 .containsExactly("active-role", "revoked-role");
     }
 
+    @Test
+    void listRulesShouldMatchAPartialPrincipalTest() throws Exception {
+        DescribeRoleListResponse response = new DescribeRoleListResponse();
+        response.setData(new RoleItem[]{role("svc-a"), role("svc-b"), 
role("other")});
+        when(client.DescribeRoleList(any())).thenReturn(response);
+
+        // The principal field is a search box in the console; an exact 
comparison returned an
+        // empty page for every partial term.
+        assertThat(service.listRules(INSTANCE_ID, "svc"))
+                .extracting(AclRuleVO::getPrincipal)
+                .containsExactly("svc-a", "svc-b");
+        assertThat(service.listRules(INSTANCE_ID, "SVC-A"))
+                .extracting(AclRuleVO::getPrincipal)
+                .containsExactly("svc-a");
+    }
+
     private static DescribeRoleListResponse incompleteRolePage() {
         RoleItem role = new RoleItem();
         role.setRoleName("role-a");

Reply via email to