rhtyd commented on a change in pull request #3248: [WIP DO NOT MERGE] server: 
offerings for specified domain(s) and zone(s) 
URL: https://github.com/apache/cloudstack/pull/3248#discussion_r288926645
 
 

 ##########
 File path: 
server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
 ##########
 @@ -5103,7 +5334,39 @@ protected void validateNtwkOffDetails(final Map<Detail, 
String> details, final M
             }
         }
 
-        final List<NetworkOfferingVO> offerings = 
_networkOfferingDao.search(sc, searchFilter);
+        if (zoneId != null) {
+            SearchBuilder<NetworkOfferingJoinVO> sb = 
networkOfferingJoinDao.createSearchBuilder();
+            sb.and("zoneId", sb.entity().getZoneId(), 
SearchCriteria.Op.FIND_IN_SET);
+            sb.or("zId", sb.entity().getZoneId(), SearchCriteria.Op.NULL);
+            sb.done();
+            SearchCriteria<NetworkOfferingJoinVO> zoneSC = sb.create();
+            zoneSC.setParameters("zoneId", String.valueOf(zoneId));
+            sc.addAnd("zoneId", SearchCriteria.Op.SC, zoneSC);
+        }
+
+        final List<NetworkOfferingJoinVO> offerings = 
networkOfferingJoinDao.search(sc, searchFilter);
+        // Remove offerings that are not associated with caller's domain
+        // TODO: Better approach
+        if (caller.getType() != Account.ACCOUNT_TYPE_ADMIN && 
CollectionUtils.isNotEmpty(offerings)) {
 
 Review comment:
   @shwstppr implement the better approach?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to