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

[17/27] git commit: updated refs/heads/ui-restyle to 205f22b

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<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/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/ui-restyle
Commit: f8976a41ce81d289709cd104acac82228536177f
Parents: 16b022b
Author: Nitin Mehta <ni...@citrix.com>
Authored: Fri Oct 4 16:16:28 2013 -0700
Committer: Nitin Mehta <ni...@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);