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 2013/04/12 00:27:28 UTC
git commit: updated refs/heads/master to 4600bd4
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 <je...@citrix.com>
Authored: Thu Apr 11 15:26:37 2013 -0700
Committer: Jessica Wang <je...@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);