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.

This commit is contained in:
Jessica Wang 2012-08-13 12:43:46 -07:00
parent 9bf7d757e8
commit e002dd0998
1 changed files with 24 additions and 20 deletions

View File

@ -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: {