You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ni...@apache.org on 2013/07/03 10:29:00 UTC

git commit: updated refs/heads/master-6-17-stable to c4bfddf

Updated Branches:
  refs/heads/master-6-17-stable d46ccc9cb -> c4bfddfc5


CLOUDSTACK-3306
Projects - Templates owned by projects that are marked as "Public" are not listed in the "community" list for other users.
Infact public templates whether registered within a project account or any other account should be visible across the board to all the accounts in the cloud
Signed off by : nitin mehta<ni...@citrix.com>


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

Branch: refs/heads/master-6-17-stable
Commit: c4bfddfc50af755c266a42158331fbfd56eae724
Parents: d46ccc9
Author: Nitin Mehta <ni...@citrix.com>
Authored: Wed Jul 3 13:44:09 2013 +0530
Committer: Nitin Mehta <ni...@citrix.com>
Committed: Wed Jul 3 13:58:40 2013 +0530

----------------------------------------------------------------------
 engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c4bfddfc/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
index 37020cd..a5f522d 100755
--- a/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
+++ b/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
@@ -581,14 +581,16 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
         	if ((listProjectResourcesCriteria == ListProjectResourcesCriteria.SkipProjectResources
         			|| (!permittedAccounts.isEmpty() && !(templateFilter == TemplateFilter.community || templateFilter == TemplateFilter.featured))) &&
         			!(caller.getType() != Account.ACCOUNT_TYPE_NORMAL && templateFilter == TemplateFilter.all)) {
-        		whereClause += " INNER JOIN account a on (t.account_id = a.id)";
+                if(templateFilter != TemplateFilter.community){
+        		    whereClause += " INNER JOIN account a on (t.account_id = a.id)";
+                }
         		if ((templateFilter == TemplateFilter.self || templateFilter == TemplateFilter.selfexecutable) && (caller.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN || caller.getType() == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN)) {
             		 whereClause += " INNER JOIN domain d on (a.domain_id = d.id) WHERE d.path LIKE '" + domain.getPath() + "%'";
              		if (listProjectResourcesCriteria == ListProjectResourcesCriteria.SkipProjectResources) {
             			whereClause += " AND a.type != " + Account.ACCOUNT_TYPE_PROJECT;
             		}
         		} else
-        			if (listProjectResourcesCriteria == ListProjectResourcesCriteria.SkipProjectResources) {
+        			if (listProjectResourcesCriteria == ListProjectResourcesCriteria.SkipProjectResources && templateFilter != TemplateFilter.community) {
         				whereClause += " WHERE a.type != " + Account.ACCOUNT_TYPE_PROJECT;
         		}
         	}