diff --git a/ui/scripts/cloudStack.js b/ui/scripts/cloudStack.js index 94914740343..b70320c8903 100644 --- a/ui/scripts/cloudStack.js +++ b/ui/scripts/cloudStack.js @@ -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, { diff --git a/ui/scripts/ui-custom/projects.js b/ui/scripts/ui-custom/projects.js index d2af84d0e64..7b3ff6450ee 100644 --- a/ui/scripts/ui-custom/projects.js +++ b/ui/scripts/ui-custom/projects.js @@ -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.
Please create a new one from the projects section.' : + 'You do not have any projects.
Please ask your administrator to create a new project.' }).closest('.ui-dialog'); $.merge($selector, $('.overlay')).remove(); $('.select.default-view').click();