CLOUDSTACK-2487: Show error while adding acl_item to default ACL
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2dc076f2 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2dc076f2 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2dc076f2 Branch: refs/heads/object_store Commit: 2dc076f232181c7534f743c1dec7416c069f7066 Parents: b66c484 Author: Kishan Kavala <[email protected]> Authored: Wed May 15 12:51:08 2013 +0530 Committer: Edison Su <[email protected]> Committed: Wed May 15 19:41:47 2013 -0700 ---------------------------------------------------------------------- .../cloud/network/vpc/NetworkACLServiceImpl.java | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2dc076f2/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java b/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java index ac59fab..00c90d5 100644 --- a/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java +++ b/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java @@ -216,8 +216,8 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ throw new InvalidParameterValueException("Network ACL can be created just for networks of type " + Networks.TrafficType.Guest); } - if(aclId != NetworkACL.DEFAULT_DENY) { - //ACL is not default DENY + if(aclId != NetworkACL.DEFAULT_DENY && aclId != NetworkACL.DEFAULT_ALLOW) { + //ACL is not default DENY/ALLOW // ACL should be associated with a VPC Vpc vpc = _vpcMgr.getVpc(acl.getVpcId()); if(vpc == null){ @@ -254,6 +254,10 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ throw new InvalidParameterValueException("Unable to find specified ACL"); } + if((aclId == NetworkACL.DEFAULT_DENY) || (aclId == NetworkACL.DEFAULT_ALLOW)){ + throw new InvalidParameterValueException("Default ACL cannot be modified"); + } + Vpc vpc = _vpcMgr.getVpc(acl.getVpcId()); if(vpc == null){ throw new InvalidParameterValueException("Unable to find Vpc associated with the NetworkACL");
