diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java index f8e030784da..9ed1cdea12d 100644 --- a/server/src/com/cloud/api/query/QueryManagerImpl.java +++ b/server/src/com/cloud/api/query/QueryManagerImpl.java @@ -3147,13 +3147,13 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q ex.addProxyObject(template.getUuid(), "templateId"); throw ex; } - if (caller.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) { + if (!template.isPublicTemplate() && caller.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) { Account template_acc = _accountMgr.getAccount(template.getAccountId()); DomainVO domain = _domainDao.findById(template_acc.getDomainId()); _accountMgr.checkAccess(caller, domain); + } - - }// if template is not public, perform permission check here + // if template is not public, perform permission check here else if (!template.isPublicTemplate() && caller.getType() != Account.ACCOUNT_TYPE_ADMIN) { _accountMgr.checkAccess(caller, null, false, template); }