zhujunxxxxx commented on a change in pull request #10310:
URL: https://github.com/apache/shardingsphere/pull/10310#discussion_r634073463
##########
File path:
shardingsphere-infra/shardingsphere-infra-authority/shardingsphere-infra-authority-common/src/main/java/org/apache/shardingsphere/authority/checker/AuthorityChecker.java
##########
@@ -56,7 +58,25 @@ public SQLCheckResult check(final SQLStatement sqlStatement,
final List<Object>
// TODO add error msg
return privileges.map(optional -> new
SQLCheckResult(optional.hasPrivileges(Collections.singletonList(getPrivilege(sqlStatement))),
"")).orElseGet(() -> new SQLCheckResult(false, ""));
}
-
+
+ @Override
+ public boolean check(final Grantee grantee, final AuthorityRule
authorityRule) {
+ Optional<ShardingSphereUser> user = authorityRule.findUser(grantee);
+ return user.isPresent() ? true : false;
+ }
+
+ @Override
+ public boolean check(final Grantee grantee, final BiPredicate<Object,
Object> validate, final Object cipher, final AuthorityRule authorityRule) {
+ Optional<ShardingSphereUser> user = authorityRule.findUser(grantee);
+ if (!user.isPresent()) {
+ return false;
+ }
+ if (validate.test(user.get(), cipher)) {
+ return true;
+ }
+ return false;
Review comment:
ok, I will fix later.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]