Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C784F10E1E for ; Thu, 3 Oct 2013 22:13:24 +0000 (UTC) Received: (qmail 46107 invoked by uid 500); 3 Oct 2013 22:13:24 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 46091 invoked by uid 500); 3 Oct 2013 22:13:24 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 46084 invoked by uid 99); 3 Oct 2013 22:13:24 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Oct 2013 22:13:24 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 6E4E990F05A; Thu, 3 Oct 2013 22:13:24 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: nitin@apache.org To: commits@cloudstack.apache.org Message-Id: <37da30ba03624996b94941e85ce9c8e7@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/master to 2229e3e Date: Thu, 3 Oct 2013 22:13:24 +0000 (UTC) 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 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 Authored: Thu Oct 3 15:10:55 2013 -0700 Committer: Nitin Mehta 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 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 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 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, Integer> uniqueVmPair = _userVmJoinDao.searchAndCount(sc, searchFilter); Integer count = uniqueVmPair.second();