From 6203013ec6b9bf09bf94f48150a4f72aba598424 Mon Sep 17 00:00:00 2001 From: niteshsarda Date: Sat, 5 Aug 2017 00:29:07 +0530 Subject: [PATCH] CLOUDSTACK-9955 : Featured Templates/Iso's created by Root/admin user are not visible to Domain Admin users (#2144) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- server/src/com/cloud/api/query/QueryManagerImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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); }