Updated Branches: refs/heads/rbac 283ec2793 -> d79cb380e
Fix a listAccount regression due to root admin role refactoring. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d79cb380 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d79cb380 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d79cb380 Branch: refs/heads/rbac Commit: d79cb380e1d42e40d2f76e6f2a265786a7fa100d Parents: 283ec27 Author: Min Chen <[email protected]> Authored: Mon Oct 7 11:53:38 2013 -0700 Committer: Min Chen <[email protected]> Committed: Mon Oct 7 11:53:38 2013 -0700 ---------------------------------------------------------------------- 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(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d79cb380/server/src/com/cloud/api/ApiDBUtils.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/ApiDBUtils.java b/server/src/com/cloud/api/ApiDBUtils.java index 1409961..21d713c 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) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d79cb380/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java index dc65687..16af802 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<AccountJoinVO, Long> 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<AccountJoinVO, Long> 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);
