cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jessicaw...@apache.org
Subject git commit: cloudstack 3.0 UI - VPC - IP Address page - configuration tab - fix a bug that root-admin was unable to see LB service of IP Address owned by regular-user or domain-admin.
Date Wed, 08 Aug 2012 17:23:55 GMT
Updated Branches:
  refs/heads/vpc 0c8ce06f6 -> 0db332887


cloudstack 3.0 UI - VPC - IP Address page - configuration tab - fix a bug that root-admin
was unable to see LB service of IP Address owned by regular-user or domain-admin.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/0db33288
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/0db33288
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/0db33288

Branch: refs/heads/vpc
Commit: 0db332887e5934a30f1ca3c1eb6d7f4b0dc56995
Parents: 0c8ce06
Author: Jessica Wang <jessica.wang@citrix.com>
Authored: Tue Aug 7 10:45:58 2012 -0700
Committer: Jessica Wang <jessica.wang@citrix.com>
Committed: Wed Aug 8 10:22:49 2012 -0700

----------------------------------------------------------------------
 ui/scripts/network.js |  261 ++++++++++++++++++++++---------------------
 1 files changed, 134 insertions(+), 127 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/0db33288/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index fbcde8d..6b79f71 100644
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -1714,137 +1714,144 @@
 										var havingVpnService = false;		
 										
                     if('networks' in args.context && args.context.networks[0].vpcid
== null) { //a non-VPC network from Guest Network section
-											$.ajax({
-												url: createURL("listNetworkOfferings&id=" + args.context.networks[0].networkofferingid),
-												dataType: "json",
-												async: false,
-												success: function(json) {
-													var networkoffering = json.listnetworkofferingsresponse.networkoffering[0];
-													$(networkoffering.service).each(function(){
-														var thisService = this;
-														if(thisService.name == "Firewall")
-															havingFirewallService = true;
-														if(thisService.name == "PortForwarding")
-															havingPortForwardingService = true;
-														if(thisService.name == "Lb")
-															havingLbService = true;
-														if(thisService.name == "Vpn")
-															havingVpnService = true;
-													});
-												}
-											});
-										}
-										else { //a VPC network from Guest Network section or from VPC section
+                      $.ajax({
+                        url: createURL('listNetworkOfferings'),
+                        data: {
+												  listAll: true,
+													id: args.context.networks[0].networkofferingid
+												},
+                        async: false,
+                        success: function(json) {
+                          var networkoffering = json.listnetworkofferingsresponse.networkoffering[0];
+                          $(networkoffering.service).each(function(){
+                            var thisService = this;
+                            if(thisService.name == "Firewall")
+                              havingFirewallService = true;
+                            if(thisService.name == "PortForwarding")
+                              havingPortForwardingService = true;
+                            if(thisService.name == "Lb")
+                              havingLbService = true;
+                            if(thisService.name == "Vpn")
+                              havingVpnService = true;
+                          });
+                        }
+                      });
+                    }
+                    else { //a VPC network from Guest Network section or from VPC section
                       // Firewall is not supported in IP from VPC section
                       // (because ACL has already supported in tier from VPC section)
-										  havingFirewallService = false;
-	                    disallowedActions.push("firewall");
-                      
-											havingVpnService = false; //VPN is not supported in IP from VPC section
-										
-										  if(args.context.ipAddresses[0].associatednetworkid == null) { //IP is not associated
with any tier yet												
-												havingPortForwardingService = true;
-												havingLbService = true;												
-											}
-											else { //IP is associated with a tier
-											  $.ajax({
-												  url: createURL("listNetworks&id=" + args.context.ipAddresses[0].associatednetworkid),
-													async: false,
-													success: function(json) {													  
-													  var networkObj = json.listnetworksresponse.network[0];													 
-														$.ajax({
-															url: createURL("listNetworkOfferings&id=" + networkObj.networkofferingid),
												
-															async: false,
-															success: function(json) {
-																var networkoffering = json.listnetworkofferingsresponse.networkoffering[0];
-																$(networkoffering.service).each(function(){
-																	var thisService = this;																	
-																	if(thisService.name == "PortForwarding")
-																		havingPortForwardingService = true;
-																	if(thisService.name == "Lb")
-																		havingLbService = true;																	
-																});
-															}
-														});																										  
-													}												
-												});
-											}
-										}
-																				
-										if(args.context.ipAddresses[0].networkOfferingConserveMode == false) {			 
-											/*
-											(1) If IP is SourceNat, no StaticNat/VPN/PortForwarding/LoadBalancer can be enabled/added.

-											*/
-											if (args.context.ipAddresses[0].issourcenat){
-											  if(havingFirewallService == false) { //firewall is not supported in IP from
VPC section (because ACL has already supported in tier from VPC section)
-													disallowedActions.push("firewall");
-												}
-											
-											  disallowedActions.push("portForwarding");			
-											  disallowedActions.push("loadBalancing");											  									
-											}
-											
-											/*
-											(2) If IP is non-SourceNat, show StaticNat/VPN/PortForwarding/LoadBalancer at
first.
-											1. Once StaticNat is enabled, hide VPN/PortForwarding/LoadBalancer.
-											2. If VPN service is supported (i.e. IP comes from Guest Network section, not
from VPC section), once VPN is enabled, hide StaticNat/PortForwarding/LoadBalancer.
-											3. Once a PortForwarding rule is added, hide StaticNat/VPN/LoadBalancer.
-											4. Once a LoadBalancer rule is added, hide StaticNat/VPN/PortForwarding.
-											*/
-											else { //args.context.ipAddresses[0].issourcenat == false		 
-												if(havingFirewallService == false)
-													disallowedActions.push("firewall");
-												if(havingPortForwardingService == false)
-													disallowedActions.push("portForwarding");
-												if(havingLbService == false)
-													disallowedActions.push("loadBalancing");
-											
-												if (args.context.ipAddresses[0].isstaticnat) { //1. Once StaticNat is enabled,
hide VPN/PortForwarding/LoadBalancer.
-												  disallowedActions.push("portForwarding");
-													disallowedActions.push("loadBalancing");
-												}
-												if (havingVpnService && args.context.ipAddresses[0].vpnenabled) { //2.
If VPN service is supported (i.e. IP comes from Guest Network section, not from VPC section),
once VPN is enabled, hide StaticNat/PortForwarding/LoadBalancer.
-													disallowedActions.push("portForwarding");
-													disallowedActions.push("loadBalancing"); 
-												}
-																																					 
-												//3. Once a PortForwarding rule is added, hide StaticNat/VPN/LoadBalancer.
-												$.ajax({
-													url: createURL('listPortForwardingRules'),
-													data: {
-														ipaddressid: args.context.ipAddresses[0].id,
-														listAll: true
-													},
-													dataType: 'json',
-													async: false,
-													success: function(json) {
-														// Get instance
-														var rules = json.listportforwardingrulesresponse.portforwardingrule;
-														if(rules != null && rules.length > 0) {																
-															disallowedActions.push("loadBalancing"); 
-														}
-													}
-												});								
-												
-												//4. Once a LoadBalancer rule is added, hide StaticNat/VPN/PortForwarding.
-												$.ajax({
-													url: createURL('listLoadBalancerRules'),
+                      havingFirewallService = false;
+                      disallowedActions.push("firewall");
+
+                      havingVpnService = false; //VPN is not supported in IP from VPC section
+
+                      if(args.context.ipAddresses[0].associatednetworkid == null) { //IP
is not associated with any tier yet
+                        havingPortForwardingService = true;
+                        havingLbService = true;
+                      }
+                      else { //IP is associated with a tier
+                        $.ajax({
+                          url: createURL('listNetworks'),
 													data: {
-														publicipid: args.context.ipAddresses[0].id,
-														listAll: true
+													  listAll: true,
+														id: args.context.ipAddresses[0].associatednetworkid
 													},
-													dataType: 'json',
-													async: false,
-													success: function(json) {
-														var rules = json.listloadbalancerrulesresponse.loadbalancerrule;
-														if(rules != null && rules.length > 0) {
-															disallowedActions.push("portForwarding");
-														}
-													}
-												});															
-											}						
-										}
-										
+                          async: false,
+                          success: function(json) {
+                            var networkObj = json.listnetworksresponse.network[0];
+                            $.ajax({
+                              url: createURL("listNetworkOfferings&id=" + networkObj.networkofferingid),
+                              async: false,
+                              success: function(json) {
+                                var networkoffering = json.listnetworkofferingsresponse.networkoffering[0];
+                                $(networkoffering.service).each(function(){
+                                  var thisService = this;
+                                  if(thisService.name == "PortForwarding")
+                                    havingPortForwardingService = true;
+                                  if(thisService.name == "Lb")
+                                    havingLbService = true;
+                                });
+                              }
+                            });
+                          }
+                        });
+                      }
+                    }
+
+                    if(args.context.ipAddresses[0].networkOfferingConserveMode == false)
{
+                      /*
+                       (1) If IP is SourceNat, no StaticNat/VPN/PortForwarding/LoadBalancer
can be enabled/added.
+                       */
+                      if (args.context.ipAddresses[0].issourcenat){
+                        if(havingFirewallService == false) { //firewall is not supported
in IP from VPC section (because ACL has already supported in tier from VPC section)
+                          disallowedActions.push("firewall");
+                        }
+
+                        disallowedActions.push("portForwarding");
+                        disallowedActions.push("loadBalancing");
+                      }
+
+                      /*
+                       (2) If IP is non-SourceNat, show StaticNat/VPN/PortForwarding/LoadBalancer
at first.
+                       1. Once StaticNat is enabled, hide VPN/PortForwarding/LoadBalancer.
+                       2. If VPN service is supported (i.e. IP comes from Guest Network section,
not from VPC section), once VPN is enabled, hide StaticNat/PortForwarding/LoadBalancer.
+                       3. Once a PortForwarding rule is added, hide StaticNat/VPN/LoadBalancer.
+                       4. Once a LoadBalancer rule is added, hide StaticNat/VPN/PortForwarding.
+                       */
+                      else { //args.context.ipAddresses[0].issourcenat == false
+                        if(havingFirewallService == false)
+                          disallowedActions.push("firewall");
+                        if(havingPortForwardingService == false)
+                          disallowedActions.push("portForwarding");
+                        if(havingLbService == false)
+                          disallowedActions.push("loadBalancing");
+
+                        if (args.context.ipAddresses[0].isstaticnat) { //1. Once StaticNat
is enabled, hide VPN/PortForwarding/LoadBalancer.
+                          disallowedActions.push("portForwarding");
+                          disallowedActions.push("loadBalancing");
+                        }
+                        if (havingVpnService && args.context.ipAddresses[0].vpnenabled)
{ //2. If VPN service is supported (i.e. IP comes from Guest Network section, not from VPC
section), once VPN is enabled, hide StaticNat/PortForwarding/LoadBalancer.
+                          disallowedActions.push("portForwarding");
+                          disallowedActions.push("loadBalancing");
+                        }
+
+                        //3. Once a PortForwarding rule is added, hide StaticNat/VPN/LoadBalancer.
+                        $.ajax({
+                          url: createURL('listPortForwardingRules'),
+                          data: {
+                            ipaddressid: args.context.ipAddresses[0].id,
+                            listAll: true
+                          },
+                          dataType: 'json',
+                          async: false,
+                          success: function(json) {
+                            // Get instance
+                            var rules = json.listportforwardingrulesresponse.portforwardingrule;
+                            if(rules != null && rules.length > 0) {
+                              disallowedActions.push("loadBalancing");
+                            }
+                          }
+                        });
+
+                        //4. Once a LoadBalancer rule is added, hide StaticNat/VPN/PortForwarding.
+                        $.ajax({
+                          url: createURL('listLoadBalancerRules'),
+                          data: {
+                            publicipid: args.context.ipAddresses[0].id,
+                            listAll: true
+                          },
+                          dataType: 'json',
+                          async: false,
+                          success: function(json) {
+                            var rules = json.listloadbalancerrulesresponse.loadbalancerrule;
+                            if(rules != null && rules.length > 0) {
+                              disallowedActions.push("portForwarding");
+                            }
+                          }
+                        });
+                      }
+                    }
+
                     return disallowedActions;
                   },
 


Mime
View raw message