Revert "Fix a listAccount regression due to root admin role refactoring."

This reverts commit d79cb380e1d42e40d2f76e6f2a265786a7fa100d.
This commit is contained in:
Min Chen 2013-10-07 12:00:38 -07:00
parent d79cb380e1
commit 440f03e548
2 changed files with 4 additions and 4 deletions

View File

@ -713,8 +713,8 @@ public class ApiDBUtils {
return _resourceLimitMgr.findCorrectResourceLimitForAccount(account, type);
}
public static long findCorrectResourceLimit(Long limit, short accountType, ResourceType type) {
return _resourceLimitMgr.findCorrectResourceLimitForAccount(accountType, limit, type);
public static long findCorrectResourceLimit(Long limit, long accountId, ResourceType type) {
return _resourceLimitMgr.findCorrectResourceLimitForAccount(accountId, limit, type);
}
public static long getResourceCount(ResourceType type, long accountId) {

View File

@ -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.getType(), ResourceType.project);
long projectLimit = ApiDBUtils.findCorrectResourceLimit(account.getProjectLimit(), account.getId(), 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.getType(), ResourceType.user_vm);
long vmLimit = ApiDBUtils.findCorrectResourceLimit(account.getVmLimit(), account.getId(), 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);