CLOUDSTACK-9955 : Featured Templates/Iso's created by Root/admin user are not visible to Domain Admin users (#2144)

ISSUE: Featured Templates/Iso's created by Root/admin user are not visible to Domain Admin users.

STEPS TO REPRODUCE

Mark a template as featured and try to view it from a domain admin user
The issue occurs for both templates and iso's registered before and after upgrade
Templates,ISO's whose owner is ROOT admin, public: Yes, featured: Yes
Log in to UI (as a domain admin, such as an admin of “TEST/TEST1” domain)
Choose “Templates”.
Error message will be shown on UI
This commit is contained in:
niteshsarda 2017-08-05 00:29:07 +05:30 committed by Rohit Yadav
parent ccf2f52041
commit 6203013ec6
1 changed files with 3 additions and 3 deletions

View File

@ -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);
}