From 635bad426b514140a2058588e91f746430237fb6 Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Thu, 4 Jan 2024 00:35:54 +0800 Subject: [PATCH] Refactor AuthorityChecker (#29645) --- .../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 0dbc7a19da2bf..f70ff7ce5e2d1 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); } }