mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-11-04 00:02:37 +01:00 
			
		
		
		
	bug 12902
Disable project creation for regular users, if 'allowusercreateprojects' == false
This commit is contained in:
		
							parent
							
								
									263065a0ff
								
							
						
					
					
						commit
						9f08581f94
					
				@ -9,9 +9,12 @@
 | 
				
			|||||||
      else if(isDomainAdmin()) {
 | 
					      else if(isDomainAdmin()) {
 | 
				
			||||||
        return ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "projects"];
 | 
					        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"];
 | 
					        return ["dashboard", "instances", "storage", "network", "templates", "events", "projects"];
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					      else { //normal user
 | 
				
			||||||
 | 
					        return ["dashboard", "instances", "storage", "network", "templates", "events"];
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    sections: {
 | 
					    sections: {
 | 
				
			||||||
      /**
 | 
					      /**
 | 
				
			||||||
@ -99,6 +102,9 @@
 | 
				
			|||||||
            g_firewallRuleUiEnabled = json.listcapabilitiesresponse.capability.firewallRuleUiEnabled.toString(); //convert boolean to string if it's boolean
 | 
					            g_firewallRuleUiEnabled = json.listcapabilitiesresponse.capability.firewallRuleUiEnabled.toString(); //convert boolean to string if it's boolean
 | 
				
			||||||
            $.cookie('firewallRuleUiEnabled', g_firewallRuleUiEnabled, { expires: 1});
 | 
					            $.cookie('firewallRuleUiEnabled', g_firewallRuleUiEnabled, { expires: 1});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            g_userProjectsEnabled = json.listcapabilitiesresponse.capability.allowusercreateprojects;
 | 
				
			||||||
 | 
					            $.cookie('userProjectsEnabled', g_userProjectsEnabled, { expires: 1 });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (json.listcapabilitiesresponse.capability.userpublictemplateenabled != null) {
 | 
					            if (json.listcapabilitiesresponse.capability.userpublictemplateenabled != null) {
 | 
				
			||||||
              g_userPublicTemplateEnabled = json.listcapabilitiesresponse.capability.userpublictemplateenabled.toString(); //convert boolean to string if it's boolean
 | 
					              g_userPublicTemplateEnabled = json.listcapabilitiesresponse.capability.userpublictemplateenabled.toString(); //convert boolean to string if it's boolean
 | 
				
			||||||
              $.cookie('userpublictemplateenabled', g_userPublicTemplateEnabled, { expires: 1});
 | 
					              $.cookie('userpublictemplateenabled', g_userPublicTemplateEnabled, { expires: 1});
 | 
				
			||||||
@ -212,6 +218,9 @@
 | 
				
			|||||||
                  $.cookie('directattachsecuritygroupsenabled', g_directAttachSecurityGroupsEnabled, { expires: 1});
 | 
					                  $.cookie('directattachsecuritygroupsenabled', g_directAttachSecurityGroupsEnabled, { expires: 1});
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                g_userProjectsEnabled = json.listcapabilitiesresponse.capability.allowusercreateprojects;
 | 
				
			||||||
 | 
					                $.cookie('userProjectsEnabled', g_userProjectsEnabled, { expires: 1 });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                args.response.success({
 | 
					                args.response.success({
 | 
				
			||||||
                  data: {
 | 
					                  data: {
 | 
				
			||||||
                    user: $.extend(true, {}, loginresponse, {
 | 
					                    user: $.extend(true, {}, loginresponse, {
 | 
				
			||||||
 | 
				
			|||||||
@ -544,8 +544,9 @@
 | 
				
			|||||||
      loadData(function() {
 | 
					      loadData(function() {
 | 
				
			||||||
        if (!$list.find('li').size()) {
 | 
					        if (!$list.find('li').size()) {
 | 
				
			||||||
          cloudStack.dialog.notice({
 | 
					          cloudStack.dialog.notice({
 | 
				
			||||||
            message: 'You do not have any projects. '
 | 
					            message: isAdmin() || g_userProjectsEnabled ?
 | 
				
			||||||
              + 'Please create a new project from the projects section.'
 | 
					              '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');
 | 
					          }).closest('.ui-dialog');
 | 
				
			||||||
          $.merge($selector, $('.overlay')).remove();
 | 
					          $.merge($selector, $('.overlay')).remove();
 | 
				
			||||||
          $('.select.default-view').click();
 | 
					          $('.select.default-view').click();
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user