ColinLeeo commented on code in PR #13158:
URL: https://github.com/apache/iotdb/pull/13158#discussion_r1924891016


##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/auth/entity/Role.java:
##########
@@ -257,16 +658,23 @@ public String toString() {
         + ", pathPrivilegeList="
         + pathPrivilegeList
         + ", systemPrivilegeSet="
-        + sysPriToString()
+        + priSetToString(sysPrivilegeSet, sysPriGrantOpt)
+        + ", AnyScopePrivilegeMap="
+        + priSetToString(anyScopePrivilegeSet, anyScopePrivilegeGrantOptSet)
+        + ", objectPrivilegeSet="
+        + objectPrivilegeMap
         + '}';
   }
 
-  private Set<String> sysPriToString() {
+  public Set<String> priSetToString(Set<PrivilegeType> privs, 
Set<PrivilegeType> grantOpt) {
     Set<String> priSet = new HashSet<>();
-    for (Integer pri : sysPrivilegeSet) {
-      StringBuilder str = new 
StringBuilder(String.valueOf(PrivilegeType.values()[pri].toString()));
-      if (sysPriGrantOpt.contains(pri)) {
-        str.append("_with_grant_option ");
+    ArrayList<PrivilegeType> privBak = new ArrayList<>(privs);
+    Collections.sort(privBak);

Review Comment:
   I need to ensure that the output order is consistent, which is crucial when 
performing string comparisons in tests.



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