You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2018/04/09 17:26:26 UTC

[GitHub] khos2ow closed pull request #2556: List template with id no longer works as domain admin

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:
users@infra.apache.org


With regards,
Apache Git Services