diff --git a/api/src/com/cloud/api/response/IPAddressResponse.java b/api/src/com/cloud/api/response/IPAddressResponse.java index a9c1769406f..ea5b793b7fb 100644 --- a/api/src/com/cloud/api/response/IPAddressResponse.java +++ b/api/src/com/cloud/api/response/IPAddressResponse.java @@ -62,7 +62,8 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR @SerializedName(ApiConstants.FOR_VIRTUAL_NETWORK) @Param(description="the virtual network for the IP address") private Boolean forVirtualNetwork; - @SerializedName(ApiConstants.VLAN_ID) @Param(description="the ID of the VLAN associated with the IP address") + @SerializedName(ApiConstants.VLAN_ID) @Param(description="the ID of the VLAN associated with the IP address." + + " This parameter is visible to ROOT admins only") private IdentityProxy vlanId = new IdentityProxy("vlan"); @SerializedName("vlanname") @Param(description="the VLAN associated with the IP address") diff --git a/api/src/com/cloud/api/response/NetworkResponse.java b/api/src/com/cloud/api/response/NetworkResponse.java index a4158f16323..0917cfafdef 100644 --- a/api/src/com/cloud/api/response/NetworkResponse.java +++ b/api/src/com/cloud/api/response/NetworkResponse.java @@ -77,7 +77,7 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes @SerializedName("related") @Param(description="related to what other network configuration") private IdentityProxy related = new IdentityProxy("networks"); - @SerializedName("broadcasturi") @Param(description="broadcast uri of the network") + @SerializedName("broadcasturi") @Param(description="broadcast uri of the network. This parameter is visible to ROOT admins only") private String broadcastUri; @SerializedName(ApiConstants.DNS1) @Param(description="the first DNS for the network") @@ -89,7 +89,7 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes @SerializedName(ApiConstants.TYPE) @Param(description="the type of the network") private String type; - @SerializedName(ApiConstants.VLAN) @Param(description="the vlan of the network") + @SerializedName(ApiConstants.VLAN) @Param(description="The vlan of the network. This parameter is visible to ROOT admins only") private String vlan; @SerializedName(ApiConstants.ACL_TYPE) @Param(description="acl type - access type to the network") diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java index 2b6a31b4cca..caabd71cd10 100755 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -833,7 +833,7 @@ public class ApiResponseHelper implements ResponseGenerator { // show this info to admin only Account account = UserContext.current().getCaller(); - if ((account == null) || account.getType() == Account.ACCOUNT_TYPE_ADMIN) { + if (account.getType() == Account.ACCOUNT_TYPE_ADMIN) { ipResponse.setVlanId(ipAddr.getVlanId()); ipResponse.setVlanName(ApiDBUtils.findVlanById(ipAddr.getVlanId()).getVlanTag()); } @@ -2967,14 +2967,17 @@ public class ApiResponseHelper implements ResponseGenerator { response.setNetmask(NetUtils.cidr2Netmask(network.getCidr())); } - if (network.getBroadcastUri() != null) { + //return vlan information only to Root admin + if (network.getBroadcastUri() != null && UserContext.current().getCaller().getType() == Account.ACCOUNT_TYPE_ADMIN) { String broadcastUri = network.getBroadcastUri().toString(); response.setBroadcastUri(broadcastUri); String vlan="N/A"; if (broadcastUri.startsWith("vlan")) { vlan = broadcastUri.substring("vlan://".length(), broadcastUri.length()); } + //return vlan information only to Root admin response.setVlan(vlan); + } DataCenter zone = ApiDBUtils.findZoneById(network.getDataCenterId());