Skip to content

Commit afaf21d

Browse files
committed
fix the permission check when user is not root for non-public template
1 parent 30e6c22 commit afaf21d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4965,15 +4965,13 @@ private Pair<List<TemplateJoinVO>, Integer> searchForTemplatesInternal(Long temp
49654965
ex.addProxyObject(template.getUuid(), "templateId");
49664966
throw ex;
49674967
}
4968+
49684969
if (!template.isPublicTemplate() && caller.getType() == Account.Type.DOMAIN_ADMIN) {
49694970
Account template_acc = accountMgr.getAccount(template.getAccountId());
49704971
DomainVO domain = _domainDao.findById(template_acc.getDomainId());
49714972
accountMgr.checkAccess(caller, domain);
4972-
}
4973-
4974-
// if template is not public, perform permission check here
4975-
else if (!template.isPublicTemplate() && caller.getType() != Account.Type.ADMIN) {
4976-
accountMgr.checkAccess(caller, null, false, template);
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);
49774975
} else if (template.isPublicTemplate()) {
49784976
accountMgr.checkAccess(caller, null, false, template);
49794977
}

0 commit comments

Comments
 (0)