cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jessicaw...@apache.org
Subject git commit: updated refs/heads/master to 4600bd4
Date Thu, 11 Apr 2013 22:27:28 GMT
Updated Branches:
  refs/heads/master 69f49e76c -> 4600bd4b9


CLOUDSTACK-1910: cloudstack UI - Regions menu - make Add/Delete/Edit Region action not available
to regular-user/domain-admin.


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

Branch: refs/heads/master
Commit: 4600bd4b99a73b5344d789b9e3db212a42422443
Parents: 69f49e7
Author: Jessica Wang <jessica.wang@citrix.com>
Authored: Thu Apr 11 15:26:37 2013 -0700
Committer: Jessica Wang <jessica.wang@citrix.com>
Committed: Thu Apr 11 15:27:11 2013 -0700

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4600bd4b/ui/scripts/regions.js
----------------------------------------------------------------------
diff --git a/ui/scripts/regions.js b/ui/scripts/regions.js
index 10057a6..ec5e21b 100644
--- a/ui/scripts/regions.js
+++ b/ui/scripts/regions.js
@@ -55,6 +55,12 @@
           actions: {
             add: {
               label: 'label.add.region',
+							preFilter: function(args) {
+                if(isAdmin())
+                  return true;
+                else
+                  return false;
+              },
               messages: {
                 notification: function() { return 'label.add.region'; }
               },
@@ -98,10 +104,9 @@
             $.ajax({
               url: createURL('listRegions&listAll=true'),
               success: function(json) {
-                var regions = json.listregionsresponse.region
-
-                args.response.success({
-                  data: regions ? regions : []
+                var items = json.listregionsresponse.region;
+                args.response.success({								 
+                  data: items
                 });
               },
               error: function(json) {
@@ -193,6 +198,7 @@
                       var region = json.listregionsresponse.region
 
                       args.response.success({
+											  actionFilter: regionActionfilter,
                         data: region ? region[0] : {}
                       });
                     },
@@ -382,4 +388,14 @@
       }
     }
   };
+		
+	var regionActionfilter = function(args) {	  
+    var allowedActions = [];    
+    if(isAdmin()) {        
+      allowedActions.push("edit");
+			allowedActions.push("remove");
+    } 
+    return allowedActions;
+  }	
+	
 })(cloudStack);


Mime
View raw message