cloudstack 3.0 UI - autoscale - configure AutoScale - fix a bug when root-admin tried to update an AutoScale created by regular-user or domain-admin, users dropdown was not correctly populated (should be populated with users under owner account instead of users under current login account).

This commit is contained in:
Jessica Wang 2012-08-07 15:17:08 -07:00 committed by Vijay Venkatachalam
parent 67ea9669ab
commit e1275b4916

View File

@ -407,25 +407,50 @@
label: 'User',
select: function(args) {
var items = [];
if(isAdmin() || isDomainAdmin()) {
$.ajax({
url: createURL('listUsers'),
data: {
domainid: g_domainid,
account: g_account
},
success: function(json) {
var users = json.listusersresponse.user;
$(users).each(function(){
items.push({id: this.id, description: this.username});
});
args.response.success({ data: items });
}
});
}
else { //regular user doesn't have access to listUers API call.
items.push({id: "", description: ""});
}
if(args.context.originalAutoscaleData == null) { //new LB rule
if(isAdmin() || isDomainAdmin()) {
$.ajax({
url: createURL('listUsers'),
data: {
domainid: g_domainid,
account: g_account
},
success: function(json) {
var users = json.listusersresponse.user;
$(users).each(function(){
items.push({id: this.id, description: this.username});
});
args.response.success({ data: items });
}
});
}
else { //regular user doesn't have access to listUers API call.
items.push({id: "", description: ""});
args.response.success({ data: items });
}
}
else { //existing LB rule
if(isAdmin() || isDomainAdmin()) {
$.ajax({
url: createURL('listUsers'),
data: {
domainid: args.context.originalAutoscaleData.context.autoscaleVmProfile.domainid,
account: args.context.originalAutoscaleData.context.autoscaleVmProfile.account
},
success: function(json) {
var users = json.listusersresponse.user;
$(users).each(function(){
items.push({id: this.id, description: this.username});
});
args.response.success({ data: items });
}
});
}
else { //regular user doesn't have access to listUers API call.
items.push({id: "", description: ""});
args.response.success({ data: items });
}
}
}
}
},