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: {
|
actions: {
|
||||||
add: {
|
add: {
|
||||||
label: 'label.add.region',
|
label: 'label.add.region',
|
||||||
|
preFilter: function(args) {
|
||||||
|
if(isAdmin())
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
},
|
||||||
messages: {
|
messages: {
|
||||||
notification: function() { return 'label.add.region'; }
|
notification: function() { return 'label.add.region'; }
|
||||||
},
|
},
|
||||||
@ -98,10 +104,9 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
url: createURL('listRegions&listAll=true'),
|
url: createURL('listRegions&listAll=true'),
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
var regions = json.listregionsresponse.region
|
var items = json.listregionsresponse.region;
|
||||||
|
|
||||||
args.response.success({
|
args.response.success({
|
||||||
data: regions ? regions : []
|
data: items
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
error: function(json) {
|
error: function(json) {
|
||||||
@ -193,6 +198,7 @@
|
|||||||
var region = json.listregionsresponse.region
|
var region = json.listregionsresponse.region
|
||||||
|
|
||||||
args.response.success({
|
args.response.success({
|
||||||
|
actionFilter: regionActionfilter,
|
||||||
data: region ? region[0] : {}
|
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);
|
})(cloudStack);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user