CRZbulabula commented on code in PR #16888:
URL: https://github.com/apache/iotdb/pull/16888#discussion_r2605447792
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/auth/ClusterAuthorityFetcher.java:
##########
@@ -169,35 +169,32 @@ public List<Integer> checkUserPathPrivileges(
String username, List<? extends PartialPath> allPath, PrivilegeType
permission) {
checkCacheAvailable();
List<Integer> posList = new ArrayList<>();
- User user = iAuthorCache.getUserCache(username);
- if (user != null) {
- if (user.isOpenIdUser()) {
- return posList;
- }
- int pos = 0;
- for (PartialPath path : allPath) {
- if (!user.checkPathPrivilege(path, permission)) {
- boolean checkFromRole = false;
- for (String rolename : user.getRoleSet()) {
- Role cachedRole = iAuthorCache.getRoleCache(rolename);
- if (cachedRole == null) {
- return checkPathFromConfigNode(username, allPath, permission);
- }
- if (cachedRole.checkPathPrivilege(path, permission)) {
- checkFromRole = true;
- break;
- }
+ User user = getUser(username);
+ if (user.isOpenIdUser()) {
+ return posList;
+ }
+ int pos = 0;
+ for (PartialPath path : allPath) {
+ if (!user.checkPathPrivilege(path, permission)) {
+ boolean checkFromRole = false;
+ for (String rolename : user.getRoleSet()) {
+ Role cachedRole = iAuthorCache.getRoleCache(rolename);
+ if (cachedRole == null) {
+ checkRoleFromConfigNode(username, rolename);
+ cachedRole = iAuthorCache.getRoleCache(rolename);
}
Review Comment:
We acknowledge ur practical suggestions, yet we still have lots work to do
before fixing the potential concurrent bugs of the whole authentication module.
Considering the `checkRoleFromConfigNode()` is invoked not only in here, we'd
better fix the related issue through another commit. Otherwise this simple
bugfix will be more complicated.
--
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]