You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by su...@apache.org on 2024/01/03 16:36:01 UTC

(shardingsphere) branch master updated: Refactor AuthorityChecker (#29645)

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

sunnianjun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 635bad426b5 Refactor AuthorityChecker (#29645)
635bad426b5 is described below

commit 635bad426b514140a2058588e91f746430237fb6
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Thu Jan 4 00:35:54 2024 +0800

    Refactor AuthorityChecker (#29645)
---
 .../apache/shardingsphere/authority/checker/AuthorityChecker.java   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/checker/AuthorityChecker.java b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/checker/AuthorityChecker.java
index 0dbc7a19da2..f70ff7ce5e2 100644
--- a/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/checker/AuthorityChecker.java
+++ b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/checker/AuthorityChecker.java
@@ -41,12 +41,12 @@ public final class AuthorityChecker {
      */
     public boolean isAuthorized(final ACLObject aclObject) {
         if (aclObject instanceof DatabaseACLObject) {
-            return isAuthorized(((DatabaseACLObject) aclObject).getDatabase());
+            return isAuthorized((DatabaseACLObject) aclObject);
         }
         return true;
     }
     
-    private boolean isAuthorized(final String database) {
-        return null == grantee || rule.findPrivileges(grantee).map(optional -> optional.hasPrivileges(database)).orElse(false);
+    private boolean isAuthorized(final DatabaseACLObject aclObject) {
+        return null == grantee || rule.findPrivileges(grantee).map(optional -> optional.hasPrivileges(aclObject.getDatabase())).orElse(false);
     }
 }