Fixed problem with displaying direct network dedicated to non-admin accounts.

This commit is contained in:
will 2010-12-31 00:46:34 -08:00
parent 7a66300fc9
commit 18d4c97b55

View File

@ -1552,13 +1552,17 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
if (type != null) {
sc.addAnd("guestType", SearchCriteria.Op.EQ, type);
}
SearchCriteria<NetworkVO> ssc = _networksDao.createSearchCriteria();
ssc.addOr("accountId", SearchCriteria.Op.EQ, accountId);
if (accountName == null && domainId == null) {
ssc.addOr("accountId", SearchCriteria.Op.EQ, 1L);
if (account.getType() != Account.ACCOUNT_TYPE_ADMIN || (accountName != null && domainId != null)) {
sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId);
}
sc.addAnd("accountId", SearchCriteria.Op.SC, ssc);
SearchCriteria<NetworkVO> ssc = _networksDao.createSearchCriteria();
/* ssc.addOr("accountId", SearchCriteria.Op.EQ, accountId);
if (accountName == null && domainId == null) {
ssc.addOr("accountId", SearchCriteria.Op.EQ, 1L);
}
sc.addAnd("accountId", SearchCriteria.Op.SC, ssc);
}*/
List<NetworkVO> networks = _networksDao.search(sc, searchFilter);