Shahar Havivi has uploaded a new change for review.

Change subject: engine: Prevent regular user from viewing payload
......................................................................

engine: Prevent regular user from viewing payload

Change-Id: I19eef08ac4d0091e5cc7b41d80e4076dd58ff84e
Signed-off-by: Shahar Havivi <shav...@redhat.com>
Bug-Url: https://bugzilla.redhat.com/855667
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetVmPayloadQuery.java
1 file changed, 11 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/96/8696/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetVmPayloadQuery.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetVmPayloadQuery.java
index 1519446..36fd7c3 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetVmPayloadQuery.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetVmPayloadQuery.java
@@ -18,17 +18,19 @@
 
     @Override
     protected void executeQueryCommand() {
-        VmDeviceDAO dao = getDbFacade().getVmDeviceDao();
-        List<VmDevice> disks = 
dao.getVmDeviceByVmIdAndType(getParameters().getId(), 
VmDeviceType.DISK.getName());
+        if (MultiLevelAdministrationHandler.isAdminUser(getUser())) {
+            VmDeviceDAO dao = getDbFacade().getVmDeviceDao();
+            List<VmDevice> disks = 
dao.getVmDeviceByVmIdAndType(getParameters().getId(), 
VmDeviceType.DISK.getName());
 
-        for (VmDevice disk: disks) {
-            if (VmPayload.isPayload(disk.getSpecParams())) {
-                VmPayload payload = new 
VmPayload(VmDeviceType.valueOf(disk.getType().toUpperCase()),
-                    disk.getSpecParams());
-                
payload.setType(VmDeviceType.valueOf(disk.getDevice().toUpperCase()));
-                payload.setContent(new 
String(Base64.decodeBase64(payload.getContent())));
+            for (VmDevice disk : disks) {
+                if (VmPayload.isPayload(disk.getSpecParams())) {
+                    VmPayload payload = new 
VmPayload(VmDeviceType.valueOf(disk.getType().toUpperCase()),
+                            disk.getSpecParams());
+                    
payload.setType(VmDeviceType.valueOf(disk.getDevice().toUpperCase()));
+                    payload.setContent(new 
String(Base64.decodeBase64(payload.getContent())));
 
-                getQueryReturnValue().setReturnValue(payload);
+                    getQueryReturnValue().setReturnValue(payload);
+                }
             }
         }
     }


--
To view, visit http://gerrit.ovirt.org/8696
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I19eef08ac4d0091e5cc7b41d80e4076dd58ff84e
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Shahar Havivi <shav...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to