Skip to content

Commit 5b1aca4

Browse files
committed
Fix build
1 parent 4eda50e commit 5b1aca4

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

api/src/main/java/org/apache/cloudstack/acl/APIChecker.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@
2525
import java.util.ArrayList;
2626
import java.util.List;
2727

28-
import org.apache.log4j.Logger;
28+
import org.apache.logging.log4j.LogManager;
29+
import org.apache.logging.log4j.Logger;
2930

3031
/**
3132
* APICheckers is designed to verify the ownership of resources and to control the access to APIs.
3233
*/
3334
public interface APIChecker extends Adapter {
34-
Logger s_logger = Logger.getLogger(APIChecker.class.getName());
35+
Logger LOGGER = LogManager.getLogger(APIChecker.class);
3536
// Interface for checking access for a role using apiname
3637
// If true, apiChecker has checked the operation
3738
// If false, apiChecker is unable to handle the operation or not implemented
@@ -59,7 +60,7 @@ default List<String> getApisAllowedToAccount(Account account, List<String> apiNa
5960
// Propagate as unchecked so callers are aware of the failure.
6061
throw new RuntimeException("Failed to check access for API [" + apiName + "] due to request limits", e);
6162
} catch (PermissionDeniedException e) {
62-
s_logger.trace("Account [" + account + "] is not allowed to access API [" + apiName + "]");
63+
LOGGER.trace("Account [" + account + "] is not allowed to access API [" + apiName + "]");
6364
}
6465
}
6566
return allowedApis;

server/src/main/java/com/cloud/user/AccountManagerImpl.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1459,11 +1459,17 @@ protected void checkRoleEscalation(Account caller, Account requested) {
14591459
escalatedApis.removeAll(callerAllowed);
14601460
String msg = String.format("User of Account %s and domain %s cannot create an account with access to more privileges than they have. Escalated APIs: %s",
14611461
caller, _domainMgr.getDomain(caller.getDomainId()), escalatedApis);
1462-
s_logger.warn(msg);
1462+
logger.warn(msg);
14631463
throw new PermissionDeniedException(msg);
14641464
}
14651465
}
14661466

1467+
private void checkApiAccess(List<APIChecker> apiCheckers, Account caller, String command) {
1468+
for (final APIChecker apiChecker : apiCheckers) {
1469+
apiChecker.checkAccess(caller, command);
1470+
}
1471+
}
1472+
14671473
@Override
14681474
public void checkApiAccess(Account caller, String command) {
14691475
List<APIChecker> apiCheckers = getEnabledApiCheckers();

0 commit comments

Comments
 (0)