mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-347: ipAddressResponse/NetworkResponse API - return vlan info only when the caller is ROOT admin
This commit is contained in:
parent
7e704d1b3d
commit
1d458c7a2d
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Reference in New Issue