You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by je...@apache.org on 2012/08/13 21:46:19 UTC

git commit: CS-15957: cloudstack 3.0 UI - VPC - private gateway - if not root-admin, show private gateway listView instead of create private gateway dialog because only root-admin is allowed to create private gateway.

Updated Branches:
  refs/heads/master 9bf7d757e -> e002dd099


CS-15957: cloudstack 3.0 UI - VPC - private gateway - if not root-admin, show private gateway listView instead of create private gateway dialog because only root-admin is allowed to create private gateway.


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

Branch: refs/heads/master
Commit: e002dd09985e65e8624357c1cc94b2fe57908f67
Parents: 9bf7d75
Author: Jessica Wang <je...@citrix.com>
Authored: Mon Aug 13 12:43:46 2012 -0700
Committer: Jessica Wang <je...@citrix.com>
Committed: Mon Aug 13 12:45:50 2012 -0700

----------------------------------------------------------------------
 ui/scripts/vpc.js |   44 ++++++++++++++++++++++++--------------------
 1 files changed, 24 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e002dd09/ui/scripts/vpc.js
----------------------------------------------------------------------
diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js
index 8cd5812..dd0dc7d 100644
--- a/ui/scripts/vpc.js
+++ b/ui/scripts/vpc.js
@@ -566,26 +566,30 @@
     },
     gateways: {
       add: {
-        preCheck: function(args) {
-          var items;
-          
-          $.ajax({
-            url: createURL('listPrivateGateways'),
-            async: false,
-            data: {
-              vpcid: args.context.vpc[0].id,
-              listAll: true
-            },
-            success: function(json) {
-              items = json.listprivategatewaysresponse.privategateway;              
-            }
-          });
-
-          if (items && items.length) {
-            return true;
-          }
-
-          return false;
+        preCheck: function(args) {          
+					if(isAdmin()) { //root-admin
+						var items;          
+						$.ajax({
+							url: createURL('listPrivateGateways'),
+							async: false,
+							data: {
+								vpcid: args.context.vpc[0].id,
+								listAll: true
+							},
+							success: function(json) {
+								items = json.listprivategatewaysresponse.privategateway;              
+							}
+						});
+						if (items && items.length) {
+							return true; //show private gateway listView
+						}
+						else {
+							return false; //show create private gateway dialog
+						}
+					}
+					else {  //regular-user, domain-admin
+					  return true; //show private gateway listView instead of create private gateway dialog because only root-admin is allowed to create private gateway
+					}
         },
         label: 'Add new gateway',
         messages: {