shwstppr commented on code in PR #6748:
URL: https://github.com/apache/cloudstack/pull/6748#discussion_r1083883721
##########
server/src/main/java/com/cloud/network/vpc/VpcManagerImpl.java:
##########
@@ -715,11 +716,22 @@ public Pair<List<? extends VpcOffering>, Integer>
listVpcOfferings(ListVPCOfferi
final String state = cmd.getState();
final Long startIndex = cmd.getStartIndex();
final Long pageSizeVal = cmd.getPageSizeVal();
+ final Long domainId = cmd.getDomainId();
final Long zoneId = cmd.getZoneId();
final Filter searchFilter = new Filter(VpcOfferingJoinVO.class,
"sortKey", QueryService.SortKeyAscending.value(), null, null);
searchFilter.addOrderBy(VpcOfferingJoinVO.class, "id", true);
final SearchCriteria<VpcOfferingJoinVO> sc =
vpcOfferingJoinDao.createSearchCriteria();
+ if (domainId != null) {
+ Domain domain = _entityMgr.findById(Domain.class, domainId);
+ if (domain == null) {
+ throw new InvalidParameterValueException("Unable to find the
domain by id=" + domainId);
+ }
+ if (!domainDao.isChildDomain(caller.getDomainId(), domainId)) {
+ throw new InvalidParameterValueException(String.format("Unable
to list VPC offerings for domain: %s as caller does not have access for it",
domain.getUuid()));
+ }
+ }
Review Comment:
Done
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]