khos2ow closed pull request #2556: List template with id no longer works as 
domain admin
URL: https://github.com/apache/cloudstack/pull/2556
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java 
b/server/src/com/cloud/api/query/QueryManagerImpl.java
index be165bae813..07b976978e9 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -3147,15 +3147,16 @@ private boolean isPermissible(Long accountDomainId, 
Long offeringDomainId) {
                 ex.addProxyObject(template.getUuid(), "templateId");
                 throw ex;
             }
-            if (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
-            else if (!template.isPublicTemplate() && caller.getType() != 
Account.ACCOUNT_TYPE_ADMIN) {
-                _accountMgr.checkAccess(caller, null, false, template);
+            // if template is not public, perform permission check here
+            if (!template.isPublicTemplate()) {
+                if (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);
+                } else if (caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {
+                    _accountMgr.checkAccess(caller, null, false, template);
+                }
             }
 
             // if templateId is specified, then we will just use the id to


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to