DaanHoogland commented on code in PR #8020:
URL: https://github.com/apache/cloudstack/pull/8020#discussion_r1341124671
##########
server/src/main/java/com/cloud/api/query/QueryManagerImpl.java:
##########
@@ -3758,6 +3758,9 @@ else if (!template.isPublicTemplate() && caller.getType()
!= Account.Type.ADMIN)
}
} else if (templateFilter == TemplateFilter.sharedexecutable ||
templateFilter == TemplateFilter.shared) {
// only show templates shared by others
+ if (permittedAccounts.isEmpty()) {
+ return new Pair<>(new ArrayList<>(), 0);
+ }
sc.addAnd("sharedAccountId", SearchCriteria.Op.IN,
permittedAccountIds.toArray());
Review Comment:
seems a bit like a hack on a hack, shouldn´t this be handled by the
`SearchCriteria<>.addAnd()`?
##########
server/src/main/java/com/cloud/api/query/QueryManagerImpl.java:
##########
@@ -3758,6 +3758,9 @@ else if (!template.isPublicTemplate() && caller.getType()
!= Account.Type.ADMIN)
}
} else if (templateFilter == TemplateFilter.sharedexecutable ||
templateFilter == TemplateFilter.shared) {
// only show templates shared by others
+ if (permittedAccounts.isEmpty()) {
+ return new Pair<>(new ArrayList<>(), 0);
+ }
sc.addAnd("sharedAccountId", SearchCriteria.Op.IN,
permittedAccountIds.toArray());
Review Comment:
seems a bit like a hack on a hack, shouldn´t this be handled by the
`SearchCriteria<>.addAnd()`?
--
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]