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/3388b771
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3388b771
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3388b771

Branch: refs/heads/ui-vpc-redesign
Commit: 3388b77156e93ff8de5f08737dd66023ed0089f2
Parents: be98501
Author: Kishan Kavala <[email protected]>
Authored: Wed May 15 12:51:08 2013 +0530
Committer: Kishan Kavala <[email protected]>
Committed: Wed May 15 12:51:08 2013 +0530

----------------------------------------------------------------------
 .../cloud/network/vpc/NetworkACLServiceImpl.java   |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3388b771/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");

Reply via email to