Skip to content

Commit 4da87bd

Browse files
committed
2 parents 6de0898 + e002dd0 commit 4da87bd

1 file changed

Lines changed: 24 additions & 20 deletions

File tree

‎ui/scripts/vpc.js‎

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -566,26 +566,30 @@
566566
},
567567
gateways: {
568568
add: {
569-
preCheck: function(args) {
570-
var items;
571-
572-
$.ajax({
573-
url: createURL('listPrivateGateways'),
574-
async: false,
575-
data: {
576-
vpcid: args.context.vpc[0].id,
577-
listAll: true
578-
},
579-
success: function(json) {
580-
items = json.listprivategatewaysresponse.privategateway;
581-
}
582-
});
583-
584-
if (items && items.length) {
585-
return true;
586-
}
587-
588-
return false;
569+
preCheck: function(args) {
570+
if(isAdmin()) { //root-admin
571+
var items;
572+
$.ajax({
573+
url: createURL('listPrivateGateways'),
574+
async: false,
575+
data: {
576+
vpcid: args.context.vpc[0].id,
577+
listAll: true
578+
},
579+
success: function(json) {
580+
items = json.listprivategatewaysresponse.privategateway;
581+
}
582+
});
583+
if (items && items.length) {
584+
return true; //show private gateway listView
585+
}
586+
else {
587+
return false; //show create private gateway dialog
588+
}
589+
}
590+
else { //regular-user, domain-admin
591+
return true; //show private gateway listView instead of create private gateway dialog because only root-admin is allowed to create private gateway
592+
}
589593
},
590594
label: 'Add new gateway',
591595
messages: {

0 commit comments

Comments
 (0)