cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [1/4] git commit: updated refs/heads/4.9 to 7c27bf3
Date Thu, 08 Dec 2016 19:04:08 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.9 80724b01b -> 7c27bf3c9


CLOUDSTACK-9594: API "list templates templatefilter=all" reveals all
templates of all domains

Bug has been fixed considering below points
1. templatefilter=all or isofilter=all is applicable only to admin
and domain admin.
2. With templatefilter=all or isofilter=all below are the visiblity
of templates in system.
a. admin should be able to see all templates/iso in system.
b. domain admin should be able to see all public template and
templates under its domain tree (including sub domain).
c. domain admin in a project context should be able to see all public
 templates and templates registered as project account and templates
 which are shared(using updateTemplatePermission api) with project account.

Modified
"test/integration/component/test_escalation_listTemplateDomainAdmin.py"
This marvin test is written for this scenario but for the second account
 "templatefilter=all" is not used.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a1323122
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a1323122
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a1323122

Branch: refs/heads/4.9
Commit: a13231226c467db0a1412f59f75fbde6c9295a90
Parents: b704cef
Author: Sudhansu <sudhansu.sahu@accelerite.com>
Authored: Fri Nov 11 17:20:24 2016 +0530
Committer: Sudhansu <sudhansu.sahu@accelerite.com>
Committed: Fri Nov 11 19:56:35 2016 +0530

----------------------------------------------------------------------
 server/src/com/cloud/api/query/QueryManagerImpl.java   | 13 +++++++++++++
 .../test_escalation_listTemplateDomainAdmin.py         |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a1323122/server/src/com/cloud/api/query/QueryManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java
index 0e3f3f2..a0e12e6 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -3233,6 +3233,19 @@ public class QueryManagerImpl extends ManagerBase implements QueryService,
Confi
                     scc.addOr("accountId", SearchCriteria.Op.IN, permittedAccountIds.toArray());
                 }
                 sc.addAnd("publicTemplate", SearchCriteria.Op.SC, scc);
+            }else if (templateFilter == TemplateFilter.all && caller.getType() !=
Account.ACCOUNT_TYPE_ADMIN ){
+                SearchCriteria<TemplateJoinVO> scc = _templateJoinDao.createSearchCriteria();
+                scc.addOr("publicTemplate", SearchCriteria.Op.EQ, true);
+
+                if (listProjectResourcesCriteria == ListProjectResourcesCriteria.SkipProjectResources)
{
+                    scc.addOr("domainPath", SearchCriteria.Op.LIKE, _domainDao.findById(caller.getDomainId()).getPath()
+ "%");
+                } else {
+                    if (!permittedAccounts.isEmpty()) {
+                        scc.addOr("accountId", SearchCriteria.Op.IN, permittedAccountIds.toArray());
+                        scc.addOr("sharedAccountId", SearchCriteria.Op.IN, permittedAccountIds.toArray());
+                    }
+                }
+                sc.addAnd("publicTemplate", SearchCriteria.Op.SC, scc);
             }
 
             // add tags criteria

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a1323122/test/integration/component/test_escalation_listTemplateDomainAdmin.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalation_listTemplateDomainAdmin.py b/test/integration/component/test_escalation_listTemplateDomainAdmin.py
index 5c52c06..087e45b 100644
--- a/test/integration/component/test_escalation_listTemplateDomainAdmin.py
+++ b/test/integration/component/test_escalation_listTemplateDomainAdmin.py
@@ -126,7 +126,7 @@ class TestlistTemplatesDomainAdmin(cloudstackTestCase):
             hypervisor=self.hypervisor,
             account=self.account2.name,
             domainid=self.account2.domainid,
-            templatefilter=self.testdata["templatefilter"]
+            templatefilter="all"
 
         )
 


Mime
View raw message