mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Bug #:5975
Merge from 2.1.x - Fixed issue where listAccounts only return one less than the actual number of accounts in the system. That is because the SQL query asks for X accounts, but the API filters out the SYSTEM account. The fix is to add the filter of the system account in the actual query itself rather than have the code do it. Conflicts: server/src/com/cloud/api/commands/ListAccountsCmd.java
This commit is contained in:
parent
e5bdec33f9
commit
f8c93cd5fa
@ -130,7 +130,6 @@ public class ListAccountsCmd extends BaseCmd{
|
||||
for (AccountVO accountO : accounts) {
|
||||
boolean accountIsAdmin = (accountO.getType() == Account.ACCOUNT_TYPE_ADMIN);
|
||||
|
||||
if ((accountO.getRemoved() == null)&&(accountO.getId() != 1)) {
|
||||
List<Pair<String, Object>> accountData = new ArrayList<Pair<String, Object>>();
|
||||
accountData.add(new Pair<String, Object>(BaseCmd.Properties.ID.getName(), Long.valueOf(accountO.getId()).toString()));
|
||||
accountData.add(new Pair<String, Object>(BaseCmd.Properties.NAME.getName(), accountO.getAccountName()));
|
||||
@ -233,7 +232,6 @@ public class ListAccountsCmd extends BaseCmd{
|
||||
|
||||
aTag[i++] = accountData;
|
||||
}
|
||||
}
|
||||
Pair<String, Object> accountTag = new Pair<String, Object>("account", aTag);
|
||||
accountTags.add(accountTag);
|
||||
return accountTags;
|
||||
|
||||
@ -4402,6 +4402,7 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
SearchBuilder<AccountVO> sb = _accountDao.createSearchBuilder();
|
||||
sb.and("accountName", sb.entity().getAccountName(), SearchCriteria.Op.LIKE);
|
||||
sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
|
||||
sb.and("nid", sb.entity().getId(), SearchCriteria.Op.NEQ);
|
||||
sb.and("type", sb.entity().getType(), SearchCriteria.Op.EQ);
|
||||
sb.and("state", sb.entity().getState(), SearchCriteria.Op.EQ);
|
||||
sb.and("needsCleanup", sb.entity().getNeedsCleanup(), SearchCriteria.Op.EQ);
|
||||
@ -4433,6 +4434,9 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
|
||||
// I want to join on user_vm.domain_id = domain.id where domain.path like 'foo%'
|
||||
sc.setJoinParameters("domainSearch", "path", domain.getPath() + "%");
|
||||
sc.setParameters("nid", 1L);
|
||||
} else {
|
||||
sc.setParameters("nid", 1L);
|
||||
}
|
||||
|
||||
if (type != null) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user