Added projectinviterequired capability to the listCapabilities API response

This commit is contained in:
Alena Prokharchyk 2011-12-09 12:34:17 -08:00
parent 0731dac370
commit 743be91e20
7 changed files with 23 additions and 20 deletions

View File

@ -319,6 +319,7 @@ public class ApiConstants {
public static final String ASSOCIATED_NETWORK_ID = "associatednetworkid";
public static final String SOURCE_NAT_SUPPORTED = "sourcenatsupported";
public static final String RESOURCE_STATE = "resourcestate";
public static final String PROJECT_INVITE_REQUIRED = "projectinviterequired";
public enum HostDetails {
all, capacity, events, stats, min;

View File

@ -51,6 +51,7 @@ public class ListCapabilitiesCmd extends BaseCmd {
response.setUserPublicTemplateEnabled((Boolean)capabilities.get("userPublicTemplateEnabled"));
response.setSupportELB((String)capabilities.get("supportELB"));
response.setFirewallRuleUiEnabled((Boolean) capabilities.get("firewallRuleUiEnabled"));
response.setProjectInviteRequired((Boolean)capabilities.get("projectInviteRequired"));
response.setObjectName("capability");
response.setResponseName(getCommandName());
this.setResponseObject(response);

View File

@ -18,9 +18,11 @@
package com.cloud.api.response;
import com.cloud.api.ApiConstants;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
public class CapabilitiesResponse extends BaseResponse {
@SerializedName("securitygroupsenabled") @Param(description="true if security groups support is enabled, false otherwise")
private boolean securityGroupsEnabled;
@ -36,26 +38,17 @@ public class CapabilitiesResponse extends BaseResponse {
@SerializedName("supportELB") @Param(description="true if region supports elastic load balancer on basic zones")
private String supportELB;
public boolean getSecurityGroupsEnabled() {
return securityGroupsEnabled;
}
@SerializedName(ApiConstants.PROJECT_INVITE_REQUIRED) @Param(description="If invitation confirmation is required when add account to project")
private Boolean projectInviteRequired;
public void setSecurityGroupsEnabled(boolean securityGroupsEnabled) {
this.securityGroupsEnabled = securityGroupsEnabled;
}
public String getCloudStackVersion() {
return cloudStackVersion;
}
public void setCloudStackVersion(String cloudStackVersion) {
this.cloudStackVersion = cloudStackVersion;
}
public boolean getUserPublicTemplateEnabled() {
return securityGroupsEnabled;
}
public void setUserPublicTemplateEnabled(boolean userPublicTemplateEnabled) {
this.userPublicTemplateEnabled = userPublicTemplateEnabled;
@ -65,15 +58,11 @@ public class CapabilitiesResponse extends BaseResponse {
this.supportELB = supportELB;
}
public String getSupportELB() {
return supportELB;
}
public void setFirewallRuleUiEnabled(boolean firewallRuleUiEnabled) {
this.firewallRuleUiEnabled = firewallRuleUiEnabled;
}
public boolean getFirewallRuleUiEnabled() {
return firewallRuleUiEnabled;
}
public void setProjectInviteRequired(Boolean projectInviteRequired) {
this.projectInviteRequired = projectInviteRequired;
}
}

View File

@ -46,6 +46,7 @@ public class ProjectResponse extends BaseResponse{
@SerializedName(ApiConstants.STATE) @Param(description="the state of the project")
private String state;
public void setId(Long id) {
this.id.setValue(id);

View File

@ -1,3 +1,4 @@
package com.cloud.projects;
import java.util.List;
@ -12,4 +13,6 @@ public interface ProjectManager extends ProjectService {
boolean deleteAccountFromProject(long projectId, long accountId);
List<Long> listPermittedProjectAccounts(long accountId);
boolean projectInviteRequired();
}

View File

@ -1124,4 +1124,10 @@ public class ProjectManagerImpl implements ProjectManager, Manager{
}
}
}
@Override
public boolean projectInviteRequired() {
return _invitationRequired;
}
}

View File

@ -3110,6 +3110,8 @@ public class ManagementServerImpl implements ManagementServer {
capabilities.put("cloudStackVersion", getVersion());
capabilities.put("supportELB", supportELB);
capabilities.put("firewallRuleUiEnabled", (firewallRuleUiEnabled != null && firewallRuleUiEnabled.equals("true")) ? true : false);
capabilities.put("firewallRuleUiEnabled", (firewallRuleUiEnabled != null && firewallRuleUiEnabled.equals("true")) ? true : false);
capabilities.put("projectInviteRequired", _projectMgr.projectInviteRequired());
return capabilities;
}