bug 12902

Disable project creation for regular users, if
'allowusercreateprojects' == false
This commit is contained in:
bfederle 2012-01-06 13:25:37 -08:00
parent 263065a0ff
commit 9f08581f94
2 changed files with 13 additions and 3 deletions

View File

@ -9,9 +9,12 @@
else if(isDomainAdmin()) {
return ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "projects"];
}
else { //normal user
else if (g_userProjectsEnabled) {
return ["dashboard", "instances", "storage", "network", "templates", "events", "projects"];
}
else { //normal user
return ["dashboard", "instances", "storage", "network", "templates", "events"];
}
},
sections: {
/**
@ -99,6 +102,9 @@
g_firewallRuleUiEnabled = json.listcapabilitiesresponse.capability.firewallRuleUiEnabled.toString(); //convert boolean to string if it's boolean
$.cookie('firewallRuleUiEnabled', g_firewallRuleUiEnabled, { expires: 1});
g_userProjectsEnabled = json.listcapabilitiesresponse.capability.allowusercreateprojects;
$.cookie('userProjectsEnabled', g_userProjectsEnabled, { expires: 1 });
if (json.listcapabilitiesresponse.capability.userpublictemplateenabled != null) {
g_userPublicTemplateEnabled = json.listcapabilitiesresponse.capability.userpublictemplateenabled.toString(); //convert boolean to string if it's boolean
$.cookie('userpublictemplateenabled', g_userPublicTemplateEnabled, { expires: 1});
@ -212,6 +218,9 @@
$.cookie('directattachsecuritygroupsenabled', g_directAttachSecurityGroupsEnabled, { expires: 1});
}
g_userProjectsEnabled = json.listcapabilitiesresponse.capability.allowusercreateprojects;
$.cookie('userProjectsEnabled', g_userProjectsEnabled, { expires: 1 });
args.response.success({
data: {
user: $.extend(true, {}, loginresponse, {

View File

@ -544,8 +544,9 @@
loadData(function() {
if (!$list.find('li').size()) {
cloudStack.dialog.notice({
message: 'You do not have any projects. '
+ 'Please create a new project from the projects section.'
message: isAdmin() || g_userProjectsEnabled ?
'You do not have any projects.<br/>Please create a new one from the projects section.' :
'You do not have any projects.<br/>Please ask your administrator to create a new project.'
}).closest('.ui-dialog');
$.merge($selector, $('.overlay')).remove();
$('.select.default-view').click();