Skip to content

Commit 823f0c9

Browse files
author
Alena Prokharchyk
committed
Fixed ipAssoc and createNetworkACL (for vpc) commands - didn't work in Project scenario
Conflicts: server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java
1 parent 43b4062 commit 823f0c9

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

‎server/src/com/cloud/network/NetworkManagerImpl.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,7 @@ public IPAddressVO associateIPToGuestNetwork(long ipId, long networkId, boolean
11421142

11431143
Network network = _networksDao.findById(networkId);
11441144
if (network != null) {
1145-
_accountMgr.checkAccess(caller, AccessType.UseNetwork, false, network);
1145+
_accountMgr.checkAccess(owner, AccessType.UseNetwork, false, network);
11461146
} else {
11471147
s_logger.debug("Unable to find ip address by id: " + ipId);
11481148
return null;

‎server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,11 @@ protected FirewallRule createNetworkACL(Account caller, String xId, Integer port
137137
Vpc vpc = _vpcMgr.getVpc(network.getVpcId());
138138
Account aclOwner = _accountMgr.getAccount(vpc.getAccountId());
139139

140-
_accountMgr.checkAccess(caller, AccessType.UseNetwork, false, network);
140+
//check if the caller can access vpc
141+
_accountMgr.checkAccess(caller, null, false, vpc);
141142

143+
//check if the acl can be created for this network
144+
_accountMgr.checkAccess(aclOwner, AccessType.UseNetwork, false, network);
142145

143146
if (!_networkMgr.areServicesSupportedInNetwork(networkId, Service.NetworkACL)) {
144147
throw new InvalidParameterValueException("Service " + Service.NetworkACL + " is not supported in network " + network);

‎server/src/com/cloud/server/ManagementServerImpl.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,7 @@ public Set<Pair<Long, Long>> listIsos(ListIsosCmd cmd) throws IllegalArgumentExc
12631263
boolean listAll = false;
12641264
if (isoFilter != null && isoFilter == TemplateFilter.all) {
12651265
if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL) {
1266-
throw new InvalidParameterValueException("Filter " + TemplateFilter.all + " can be specified by admin only", null);
1266+
throw new InvalidParameterValueException("Filter " + TemplateFilter.all + " can be specified by admin only");
12671267
}
12681268
listAll = true;
12691269
}
@@ -1292,7 +1292,7 @@ public Set<Pair<Long, Long>> listTemplates(ListTemplatesCmd cmd) throws IllegalA
12921292
boolean listAll = false;
12931293
if (templateFilter != null && templateFilter == TemplateFilter.all) {
12941294
if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL) {
1295-
throw new InvalidParameterValueException("Filter " + TemplateFilter.all + " can be specified by admin only", null);
1295+
throw new InvalidParameterValueException("Filter " + TemplateFilter.all + " can be specified by admin only");
12961296
}
12971297
listAll = true;
12981298
}

0 commit comments

Comments
 (0)