@@ -1164,6 +1164,25 @@ private void setVpcIdInResponse(Long vpcId, Consumer<String> vpcUuidSetter, Cons
11641164 vpcUuidSetter .accept (vpc .getUuid ());
11651165 }
11661166
1167+ private void setAclIdInResponse (Network network , NetworkResponse response ) {
1168+ if (network .getNetworkACLId () == null ) {
1169+ return ;
1170+ }
1171+
1172+ NetworkACL acl = ApiDBUtils .findByNetworkACLId (network .getNetworkACLId ());
1173+ if (acl == null ) {
1174+ return ;
1175+ }
1176+
1177+ if (!response .getVpcAccess () && acl .getVpcId () != 0 ) {
1178+ logger .debug ("[{}] not set in response, since caller does not have access to it." , acl );
1179+ return ;
1180+ }
1181+
1182+ response .setAclId (acl .getUuid ());
1183+ response .setAclName (acl .getName ());
1184+ }
1185+
11671186 private void showVmInfoForSharedNetworks (boolean forVirtualNetworks , IpAddress ipAddr , IPAddressResponse ipResponse ) {
11681187 if (!forVirtualNetworks ) {
11691188 NicVO nic = ApiDBUtils .findByIp4AddressAndNetworkId (ipAddr .getAddress ().toString (), ipAddr .getNetworkId ());
@@ -2662,6 +2681,7 @@ public NetworkResponse createNetworkResponse(ResponseView view, Network network)
26622681
26632682
26642683 setVpcIdInResponse (network .getVpcId (), response ::setVpcId , response ::setVpcName , response ::setVpcAccess );
2684+ setAclIdInResponse (network , response );
26652685
26662686 setResponseAssociatedNetworkInformation (response , network .getId ());
26672687
@@ -2678,14 +2698,6 @@ public NetworkResponse createNetworkResponse(ResponseView view, Network network)
26782698 response .setHasAnnotation (annotationDao .hasAnnotations (network .getUuid (), AnnotationService .EntityType .NETWORK .name (),
26792699 _accountMgr .isRootAdmin (CallContext .current ().getCallingAccount ().getId ())));
26802700
2681- if (network .getNetworkACLId () != null ) {
2682- NetworkACL acl = ApiDBUtils .findByNetworkACLId (network .getNetworkACLId ());
2683- if (acl != null ) {
2684- response .setAclId (acl .getUuid ());
2685- response .setAclName (acl .getName ());
2686- }
2687- }
2688-
26892701 response .setStrechedL2Subnet (network .isStrechedL2Network ());
26902702 if (network .isStrechedL2Network ()) {
26912703 Set <String > networkSpannedZones = new HashSet <String >();
0 commit comments