Remove unnecessary if-else branch in template permission validation (#12683)

* consolidate if-else branch
This commit is contained in:
Manoj Kumar 2026-05-08 06:07:31 +05:30 committed by GitHub
parent f6efda50d2
commit 4425ee4234
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 6 deletions

View File

@ -5034,16 +5034,13 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q
ex.addProxyObject(template.getUuid(), "templateId");
throw ex;
}
if (!template.isPublicTemplate() && caller.getType() == 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
else if (!template.isPublicTemplate() && caller.getType() != Account.Type.ADMIN) {
accountMgr.checkAccess(caller, null, false, template);
} else if (template.isPublicTemplate()) {
} else if (template.isPublicTemplate() || caller.getType() != Account.Type.ADMIN) {
// if template is not public or non-admin caller, perform permission check here
accountMgr.checkAccess(caller, null, false, template);
}