Omer Frenkel has uploaded a new change for review.

Change subject: core: remove check for permissions on pool on detach user from 
vm (#850741)
......................................................................

core: remove check for permissions on pool on detach user from vm (#850741)

https://bugzilla.redhat.com/show_bug.cgi?id=850741

When detaching user from pool-vm, there is a check that the user has
permissions on the pool.

this check is not correct since user may have lost his permissions on
the pool before stopping the vm, this check was removed.
anyway user is detached from vms in this pool so it has no meaning.

Change-Id: I3bfb1a741c6be33427e94d944a8c41d3553cba80
Signed-off-by: Omer Frenkel <ofren...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/DetachUserFromVmFromPoolCommand.java
1 file changed, 2 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/84/7484/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/DetachUserFromVmFromPoolCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/DetachUserFromVmFromPoolCommand.java
index 45a0872..6fef226 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/DetachUserFromVmFromPoolCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/DetachUserFromVmFromPoolCommand.java
@@ -3,11 +3,9 @@
 import java.util.List;
 
 import org.ovirt.engine.core.bll.context.CommandContext;
-import org.ovirt.engine.core.common.VdcObjectType;
 import org.ovirt.engine.core.common.action.VdcActionType;
 import org.ovirt.engine.core.common.action.VmOperationParameterBase;
 import org.ovirt.engine.core.common.action.VmPoolSimpleUserParameters;
-import org.ovirt.engine.core.common.businessentities.ActionGroup;
 import org.ovirt.engine.core.common.businessentities.Snapshot.SnapshotType;
 import org.ovirt.engine.core.common.businessentities.VM;
 import org.ovirt.engine.core.common.businessentities.permissions;
@@ -32,18 +30,10 @@
 
     }
 
-    protected boolean IsUserAttachedToPool() {
-        // Check first if user attached to pool directly
-        boolean attached = getVmPoolId() != null
-                && DbFacade.getInstance().getEntityPermissions(getAdUserId(), 
ActionGroup.VM_POOL_BASIC_OPERATIONS,
-                        getVmPoolId().getValue(), VdcObjectType.VmPool) != 
null;
-        return attached;
-    }
-
     protected void DetachAllVmsFromUser() {
         List<VM> vms = 
DbFacade.getInstance().getVmDAO().getAllForUser(getAdUserId());
         for (VM vm : vms) {
-            if (getVmPoolId() != null && 
getVmPoolId().equals(vm.getVmPoolId())) {
+            if (getVmPoolId().equals(vm.getVmPoolId())) {
                 permissions perm = DbFacade
                         .getInstance()
                         .getPermissionDAO()
@@ -74,7 +64,7 @@
 
     @Override
     protected void executeCommand() {
-        if (IsUserAttachedToPool()) {
+        if (getVmPoolId() != null) {
             DetachAllVmsFromUser();
         }
         setSucceeded(true);


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

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

Reply via email to