Skip to content

Commit fe7fc5a

Browse files
committed
consolidate if-else branch
1 parent afaf21d commit fe7fc5a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

server/src/main/java/com/cloud/api/query/QueryManagerImpl.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4970,9 +4970,8 @@ private Pair<List<TemplateJoinVO>, Integer> searchForTemplatesInternal(Long temp
49704970
Account template_acc = accountMgr.getAccount(template.getAccountId());
49714971
DomainVO domain = _domainDao.findById(template_acc.getDomainId());
49724972
accountMgr.checkAccess(caller, domain);
4973-
} else if (!template.isPublicTemplate() && caller.getType() != Account.Type.ADMIN) { // if template is not public, perform permission check here
4974-
accountMgr.checkAccess(caller, null, true, template);
4975-
} else if (template.isPublicTemplate()) {
4973+
} else if (template.isPublicTemplate() || caller.getType() != Account.Type.ADMIN) {
4974+
// if template is not public or non-admin caller, perform permission check here
49764975
accountMgr.checkAccess(caller, null, false, template);
49774976
}
49784977

0 commit comments

Comments
 (0)