mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fix a listAccount regression due to root admin role refactoring.
This commit is contained in:
parent
283ec27934
commit
d79cb380e1
@ -713,8 +713,8 @@ public class ApiDBUtils {
|
|||||||
return _resourceLimitMgr.findCorrectResourceLimitForAccount(account, type);
|
return _resourceLimitMgr.findCorrectResourceLimitForAccount(account, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long findCorrectResourceLimit(Long limit, long accountId, ResourceType type) {
|
public static long findCorrectResourceLimit(Long limit, short accountType, ResourceType type) {
|
||||||
return _resourceLimitMgr.findCorrectResourceLimitForAccount(accountId, limit, type);
|
return _resourceLimitMgr.findCorrectResourceLimitForAccount(accountType, limit, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getResourceCount(ResourceType type, long accountId) {
|
public static long getResourceCount(ResourceType type, long accountId) {
|
||||||
|
|||||||
@ -80,7 +80,7 @@ public class AccountJoinDaoImpl extends GenericDaoBase<AccountJoinVO, Long> impl
|
|||||||
setResourceLimits(account, accountIsAdmin, accountResponse);
|
setResourceLimits(account, accountIsAdmin, accountResponse);
|
||||||
|
|
||||||
//get resource limits for projects
|
//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);
|
String projectLimitDisplay = (accountIsAdmin || projectLimit == -1) ? "Unlimited" : String.valueOf(projectLimit);
|
||||||
long projectTotal = (account.getProjectTotal() == null) ? 0 : account.getProjectTotal();
|
long projectTotal = (account.getProjectTotal() == null) ? 0 : account.getProjectTotal();
|
||||||
String projectAvail = (accountIsAdmin || projectLimit == -1) ? "Unlimited" : String.valueOf(projectLimit - projectTotal);
|
String projectAvail = (accountIsAdmin || projectLimit == -1) ? "Unlimited" : String.valueOf(projectLimit - projectTotal);
|
||||||
@ -115,7 +115,7 @@ public class AccountJoinDaoImpl extends GenericDaoBase<AccountJoinVO, Long> impl
|
|||||||
@Override
|
@Override
|
||||||
public void setResourceLimits(AccountJoinVO account, boolean accountIsAdmin, ResourceLimitAndCountResponse response) {
|
public void setResourceLimits(AccountJoinVO account, boolean accountIsAdmin, ResourceLimitAndCountResponse response) {
|
||||||
// Get resource limits and counts
|
// 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);
|
String vmLimitDisplay = (accountIsAdmin || vmLimit == -1) ? "Unlimited" : String.valueOf(vmLimit);
|
||||||
long vmTotal = (account.getVmTotal() == null) ? 0 : account.getVmTotal();
|
long vmTotal = (account.getVmTotal() == null) ? 0 : account.getVmTotal();
|
||||||
String vmAvail = (accountIsAdmin || vmLimit == -1) ? "Unlimited" : String.valueOf(vmLimit - vmTotal);
|
String vmAvail = (accountIsAdmin || vmLimit == -1) ? "Unlimited" : String.valueOf(vmLimit - vmTotal);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user