shwstppr commented on a change in pull request #5854:
URL: https://github.com/apache/cloudstack/pull/5854#discussion_r788414887



##########
File path: 
plugins/acl/static-role-based/src/main/java/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java
##########
@@ -80,10 +80,16 @@ public boolean checkAccess(User user, String commandName) 
throws PermissionDenie
             throw new PermissionDeniedException("The account id=" + 
user.getAccountId() + "for user id=" + user.getId() + "is null");
         }
 
-        RoleType roleType = accountService.getRoleType(account);
+        final Role accountRole = roleService.findRole(account.getRoleId());
+        return checkAccessWithoutEnabledCheck(account, user, commandName, 
accountRole);
+    }
+
+    @Override
+    public boolean checkAccessWithoutEnabledCheck(Account account, User user, 
String commandName, Role accountRole) throws PermissionDeniedException {
+        RoleType roleType = accountRole.getRoleType();
         boolean isAllowed =
-            commandsPropertiesOverrides.contains(commandName) ? 
commandsPropertiesRoleBasedApisMap.get(roleType).contains(commandName) : 
annotationRoleBasedApisMap.get(
-                roleType).contains(commandName);
+                commandsPropertiesOverrides.contains(commandName) ? 
commandsPropertiesRoleBasedApisMap.get(roleType).contains(commandName) : 
annotationRoleBasedApisMap.get(
+                        roleType).contains(commandName);

Review comment:
       IDE did that tbh




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