From d79cb380e1d42e40d2f76e6f2a265786a7fa100d Mon Sep 17 00:00:00 2001 From: Min Chen Date: Mon, 7 Oct 2013 11:53:38 -0700 Subject: [PATCH] Fix a listAccount regression due to root admin role refactoring. --- server/src/com/cloud/api/ApiDBUtils.java | 4 ++-- server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/src/com/cloud/api/ApiDBUtils.java b/server/src/com/cloud/api/ApiDBUtils.java index 1409961b167..21d713c6d35 100755 --- a/server/src/com/cloud/api/ApiDBUtils.java +++ b/server/src/com/cloud/api/ApiDBUtils.java @@ -713,8 +713,8 @@ public class ApiDBUtils { return _resourceLimitMgr.findCorrectResourceLimitForAccount(account, type); } - public static long findCorrectResourceLimit(Long limit, long accountId, ResourceType type) { - return _resourceLimitMgr.findCorrectResourceLimitForAccount(accountId, limit, type); + public static long findCorrectResourceLimit(Long limit, short accountType, ResourceType type) { + return _resourceLimitMgr.findCorrectResourceLimitForAccount(accountType, limit, type); } public static long getResourceCount(ResourceType type, long accountId) { diff --git a/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java index dc65687d7e6..16af8026302 100644 --- a/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java +++ b/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java @@ -80,7 +80,7 @@ public class AccountJoinDaoImpl extends GenericDaoBase impl setResourceLimits(account, accountIsAdmin, accountResponse); //get resource limits for projects - long projectLimit = ApiDBUtils.findCorrectResourceLimit(account.getProjectLimit(), account.getId(), ResourceType.project); + long projectLimit = ApiDBUtils.findCorrectResourceLimit(account.getProjectLimit(), account.getType(), ResourceType.project); String projectLimitDisplay = (accountIsAdmin || projectLimit == -1) ? "Unlimited" : String.valueOf(projectLimit); long projectTotal = (account.getProjectTotal() == null) ? 0 : account.getProjectTotal(); String projectAvail = (accountIsAdmin || projectLimit == -1) ? "Unlimited" : String.valueOf(projectLimit - projectTotal); @@ -115,7 +115,7 @@ public class AccountJoinDaoImpl extends GenericDaoBase impl @Override public void setResourceLimits(AccountJoinVO account, boolean accountIsAdmin, ResourceLimitAndCountResponse response) { // Get resource limits and counts - long vmLimit = ApiDBUtils.findCorrectResourceLimit(account.getVmLimit(), account.getId(), ResourceType.user_vm); + long vmLimit = ApiDBUtils.findCorrectResourceLimit(account.getVmLimit(), account.getType(), ResourceType.user_vm); String vmLimitDisplay = (accountIsAdmin || vmLimit == -1) ? "Unlimited" : String.valueOf(vmLimit); long vmTotal = (account.getVmTotal() == null) ? 0 : account.getVmTotal(); String vmAvail = (accountIsAdmin || vmLimit == -1) ? "Unlimited" : String.valueOf(vmLimit - vmTotal);