mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-1910: cloudstack UI - Regions menu - make Add/Delete/Edit Region action not available to regular-user/domain-admin.
This commit is contained in:
parent
69f49e76cf
commit
4600bd4b99
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user