cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ni...@apache.org
Subject git commit: updated refs/heads/master to 2229e3e
Date Thu, 03 Oct 2013 22:13:24 GMT
Updated Branches:
  refs/heads/master 59ad4a9ab -> 2229e3e24


CLOUDSTACK-4803:
fix listVirtualMachines to not display vms to the normal users with forDisplay=false. But
displayvms to ROOT Admin irrespective of the flag.
Signed off by : nitin mehta<nitin.mehta@citrix.com>


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

Branch: refs/heads/master
Commit: 2229e3e2426a4cd04884ffcf8406080bd6aa8ec0
Parents: 59ad4a9
Author: Nitin Mehta <nitin.mehta@citrix.com>
Authored: Thu Oct 3 15:10:55 2013 -0700
Committer: Nitin Mehta <nitin.mehta@citrix.com>
Committed: Thu Oct 3 15:10:55 2013 -0700

----------------------------------------------------------------------
 server/src/com/cloud/api/query/QueryManagerImpl.java | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2229e3e2/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 5f3cceb..0691a2e 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -768,6 +768,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
             ListProjectResourcesCriteria listProjectResourcesCriteria, Map<String, String>
tags) {
         Filter searchFilter = new Filter(UserVmJoinVO.class, c.getOrderBy(), c.getAscending(),
c.getOffset(),
                 c.getLimit());
+        boolean isRootAdmin = _accountMgr.isRootAdmin(caller.getType());
 
         // first search distinct vm id by using query criteria and pagination
         SearchBuilder<UserVmJoinVO> sb = _userVmJoinDao.createSearchBuilder();
@@ -831,6 +832,10 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
             sb.and("affinityGroupId", sb.entity().getAffinityGroupId(), SearchCriteria.Op.EQ);
         }
 
+        if(!isRootAdmin){
+            sb.and("displayVm", sb.entity().isDisplayVm(), SearchCriteria.Op.EQ);
+        }
+
         // populate the search criteria with the values passed in
         SearchCriteria<UserVmJoinVO> sc = sb.create();
 
@@ -936,6 +941,9 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
             sc.setParameters("affinityGroupId", affinityGroupId);
         }
 
+        if(!isRootAdmin){
+            sc.setParameters("displayVm", 1);
+        }
         // search vm details by ids
         Pair<List<UserVmJoinVO>, Integer> uniqueVmPair = _userVmJoinDao.searchAndCount(sc,
searchFilter);
         Integer count = uniqueVmPair.second();


Mime
View raw message