mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
Fixed listNetwork by id
This commit is contained in:
parent
8a7feb8ec1
commit
c9e60d703d
@ -1843,38 +1843,38 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||||||
throw new InvalidParameterValueException("System network belongs to system, account and domainId parameters can't be specified");
|
throw new InvalidParameterValueException("System network belongs to system, account and domainId parameters can't be specified");
|
||||||
}
|
}
|
||||||
|
|
||||||
DomainVO domain = null;
|
|
||||||
if (domainId != null) {
|
if (domainId != null) {
|
||||||
domain = _domainDao.findById(domainId);
|
DomainVO domain = _domainDao.findById(domainId);
|
||||||
if (domain == null) {
|
if (domain == null) {
|
||||||
throw new InvalidParameterValueException("Domain id=" + domainId + " doesn't exist in the system");
|
throw new InvalidParameterValueException("Domain id=" + domainId + " doesn't exist in the system");
|
||||||
}
|
}
|
||||||
|
|
||||||
_accountMgr.checkAccess(caller, domain);
|
_accountMgr.checkAccess(caller, domain);
|
||||||
|
if (accountName != null) {
|
||||||
|
Account owner = _accountMgr.getActiveAccount(accountName, domainId);
|
||||||
|
if (owner == null) {
|
||||||
|
throw new InvalidParameterValueException("Unable to find account " + accountName + " in domain " + domainId);
|
||||||
|
}
|
||||||
|
|
||||||
|
_accountMgr.checkAccess(caller, owner);
|
||||||
|
accountId = owner.getId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_accountMgr.isAdmin(caller.getType())) {
|
if (!_accountMgr.isAdmin(caller.getType())) {
|
||||||
if (domainId != null) {
|
|
||||||
if (accountName != null) {
|
|
||||||
Account owner = _accountMgr.getActiveAccount(accountName, domainId);
|
|
||||||
if (owner == null) {
|
|
||||||
throw new InvalidParameterValueException("Unable to find account " + accountName + " in domain " + domainId);
|
|
||||||
}
|
|
||||||
accountId = owner.getId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
accountId = caller.getId();
|
accountId = caller.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
path = _domainDao.findById(caller.getDomainId()).getPath();
|
path = _domainDao.findById(caller.getDomainId()).getPath();
|
||||||
|
|
||||||
if (domainId == null) {
|
|
||||||
domainId = caller.getDomainId();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((isSystem == null || !isSystem) && (isShared == null || isShared)) {
|
if ((isSystem == null || !isSystem) && (isShared == null || isShared)) {
|
||||||
sharedNetworkDomainId = domainId;
|
if (isShared != null && isShared && caller.getId() != Account.ACCOUNT_ID_SYSTEM && domainId == null) {
|
||||||
|
sharedNetworkDomainId = caller.getDomainId();
|
||||||
|
} else if (isShared == null && caller.getType() != Account.ACCOUNT_TYPE_ADMIN && domainId == null) {
|
||||||
|
sharedNetworkDomainId = caller.getDomainId();
|
||||||
|
}else{
|
||||||
|
sharedNetworkDomainId = domainId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Filter searchFilter = new Filter(NetworkVO.class, "id", false, cmd.getStartIndex(), cmd.getPageSizeVal());
|
Filter searchFilter = new Filter(NetworkVO.class, "id", false, cmd.getStartIndex(), cmd.getPageSizeVal());
|
||||||
@ -1914,7 +1914,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||||||
}
|
}
|
||||||
|
|
||||||
//if user requested only domain specific networks, don't return account/zone wide networks
|
//if user requested only domain specific networks, don't return account/zone wide networks
|
||||||
if (!(isShared != null && isShared && cmd.getDomainId() != null) && (accountId != null || (domainId == null && accountName == null))) {
|
if (accountId != null || (domainId == null && accountName == null)) {
|
||||||
networksToReturn.addAll(listAccountSpecificAndZoneLevelNetworks(buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, type, isDefault, trafficType, isShared), searchFilter, accountId, path));
|
networksToReturn.addAll(listAccountSpecificAndZoneLevelNetworks(buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, type, isDefault, trafficType, isShared), searchFilter, accountId, path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user