From 335e81cc52971ffc7a9bda5d1ad79e4c95d488eb Mon Sep 17 00:00:00 2001 From: alena Date: Fri, 7 Jan 2011 14:03:29 -0800 Subject: [PATCH] Fixed listNetworks for regular user to return system network information --- server/src/com/cloud/network/NetworkManagerImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index 6108150bac5..6020d0efc0a 100755 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -1430,6 +1430,11 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag isSystem = false; } + //Account/domainId parameters and isSystem are mutually exclusive + if (isSystem && (accountName != null || domainId != null)) { + throw new InvalidParameterValueException("System network belongs to system, account and domainId parameters can't be specified"); + } + if (_accountMgr.isAdmin(account.getType())) { if (domainId != null) { if ((account != null) && !_domainDao.isChildDomain(account.getDomainId(), domainId)) { @@ -1492,7 +1497,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag if (type != null) { sc.addAnd("guestType", SearchCriteria.Op.EQ, type); } - if (account.getType() != Account.ACCOUNT_TYPE_ADMIN || (accountName != null && domainId != null)) { + + if (!isSystem && (account.getType() != Account.ACCOUNT_TYPE_ADMIN || (accountName != null && domainId != null))) { sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId); }