Oved Ourfali has uploaded a new change for review.

Change subject: userportal+core: Cannot change VM cluster in UP (#863139)
......................................................................

userportal+core: Cannot change VM cluster in UP (#863139)

https://bugzilla.redhat.com/863139

When trying to change the VM cluster from the user portal, the clusters
aren't displayed properly for PowerUsers. This patch changes the
behavior to require CREATE_VM on the cluster in order to do that, rather
than EDIT_VM_PROPERTIES.

Change-Id: I7fd4f6912c21a8d24e79d67c22007e1061ff0b1a
Signed-off-by: Oved Ourfali <oourf...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChangeVMClusterCommand.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UserPortalExistingVmModelBehavior.java
2 files changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/24/8724/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChangeVMClusterCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChangeVMClusterCommand.java
index e6ac59b..79de676 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChangeVMClusterCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ChangeVMClusterCommand.java
@@ -9,6 +9,7 @@
 import org.ovirt.engine.core.bll.utils.PermissionSubject;
 import org.ovirt.engine.core.common.VdcObjectType;
 import org.ovirt.engine.core.common.action.ChangeVMClusterParameters;
+import org.ovirt.engine.core.common.businessentities.ActionGroup;
 import org.ovirt.engine.core.common.businessentities.VDSGroup;
 import org.ovirt.engine.core.common.businessentities.VM;
 import org.ovirt.engine.core.common.businessentities.VmNetworkInterface;
@@ -179,8 +180,9 @@
     @Override
     public List<PermissionSubject> getPermissionCheckSubjects() {
         List<PermissionSubject> permissionList = new 
ArrayList<PermissionSubject>();
+        // In addition to having EDIT_VM_PROPERTIES on the VM, you must have 
CREATE_VM on the cluster
         permissionList.add(new PermissionSubject(getParameters().getVmId(), 
VdcObjectType.VM, getActionType().getActionGroup()));
-        permissionList.add(new 
PermissionSubject(getParameters().getClusterId(), VdcObjectType.VdsGroups, 
getActionType().getActionGroup()));
+        permissionList.add(new 
PermissionSubject(getParameters().getClusterId(), VdcObjectType.VdsGroups, 
ActionGroup.CREATE_VM));
         return permissionList;
     }
 }
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UserPortalExistingVmModelBehavior.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UserPortalExistingVmModelBehavior.java
index cc26fef..4335472 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UserPortalExistingVmModelBehavior.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UserPortalExistingVmModelBehavior.java
@@ -23,7 +23,7 @@
 
 public class UserPortalExistingVmModelBehavior extends ExistingVmModelBehavior
 {
-    private static final ActionGroup EDIT_VM_PROPERTIES = 
ActionGroup.EDIT_VM_PROPERTIES;
+    private static final ActionGroup CREATE_VM = ActionGroup.CREATE_VM;
 
     public UserPortalExistingVmModelBehavior(VM vm)
     {
@@ -51,7 +51,7 @@
                         behavior.InitCdImage();
 
                     }
-                }, getModel().getHash()), EDIT_VM_PROPERTIES);
+                }, getModel().getHash()), CREATE_VM);
 
         if (dataCenter.getQuotaEnforcementType() != 
QuotaEnforcementTypeEnum.DISABLED) {
             getModel().getQuota().setIsAvailable(true);


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

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

Reply via email to