Updated Branches: refs/heads/master 16b022b1b -> f8976a41c
CLOUDSTACK-3101: fix listVolumes to not display volumes to the normal users with forDisplay=false. But display volumes to ROOT Admin irrespective of the flag. Signed off by : nitin mehta<nitin.me...@citrix.com> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f8976a41 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f8976a41 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f8976a41 Branch: refs/heads/master Commit: f8976a41ce81d289709cd104acac82228536177f Parents: 16b022b Author: Nitin Mehta <nitin.me...@citrix.com> Authored: Fri Oct 4 16:16:28 2013 -0700 Committer: Nitin Mehta <nitin.me...@citrix.com> Committed: Fri Oct 4 16:16:28 2013 -0700 ---------------------------------------------------------------------- .../cloudstack/api/command/user/volume/UpdateVolumeCmd.java | 2 +- server/src/com/cloud/api/query/QueryManagerImpl.java | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f8976a41/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java index bc17b2e..929996e 100644 --- a/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java @@ -35,7 +35,7 @@ import com.cloud.storage.Volume; @APICommand(name = "updateVolume", description="Updates the volume.", responseObject=VolumeResponse.class) public class UpdateVolumeCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(UpdateVolumeCmd.class.getName()); - private static final String s_name = "addVolumeresponse"; + private static final String s_name = "updatevolumeresponse"; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f8976a41/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 0691a2e..5580c31 100644 --- a/server/src/com/cloud/api/query/QueryManagerImpl.java +++ b/server/src/com/cloud/api/query/QueryManagerImpl.java @@ -1630,6 +1630,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { String keyword = cmd.getKeyword(); String type = cmd.getType(); Map<String, String> tags = cmd.getTags(); + boolean isRootAdmin = _accountMgr.isRootAdmin(caller.getType()); Long zoneId = cmd.getZoneId(); Long podId = null; @@ -1671,6 +1672,9 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { // display UserVM volumes only sb.and().op("type", sb.entity().getVmType(), SearchCriteria.Op.NIN); sb.or("nulltype", sb.entity().getVmType(), SearchCriteria.Op.NULL); + if(!isRootAdmin){ + sb.and("displayVolume", sb.entity().isDisplayVolume(), SearchCriteria.Op.EQ); + } sb.cp(); @@ -1721,6 +1725,10 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { sc.setParameters("podId", podId); } + if(!isRootAdmin){ + sc.setParameters("displayVolume", 1); + } + // Don't return DomR and ConsoleProxy volumes sc.setParameters("type", VirtualMachine.Type.ConsoleProxy, VirtualMachine.Type.SecondaryStorageVm, VirtualMachine.Type.DomainRouter);