Search in sources :

Example 1 with DetachUserFromVmFromPoolParameters

use of org.ovirt.engine.core.common.action.DetachUserFromVmFromPoolParameters in project ovirt-engine by oVirt.

the class RemovePermissionCommand method executeCommand.

@Override
protected void executeCommand() {
    Permission perms = getParameters().getPermission();
    Guid userId = perms.getAdElementId();
    // check if vm is from pool and detach it
    if (perms.getObjectType().equals(VdcObjectType.VM) && perms.getRoleId().equals(PredefinedRoles.ENGINE_USER.getId())) {
        VM vm = vmDao.get(perms.getObjectId());
        if (vm != null && vm.getVmPoolId() != null) {
            runInternalActionWithTasksContext(ActionType.DetachUserFromVmFromPool, new DetachUserFromVmFromPoolParameters(vm.getVmPoolId(), userId, vm.getId(), true));
        }
    }
    vmStaticDao.incrementDbGeneration(perms.getObjectId());
    permissionDao.remove(perms.getId());
    dbUserDao.updateLastAdminCheckStatus(userId);
    setSucceeded(true);
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) Permission(org.ovirt.engine.core.common.businessentities.Permission) Guid(org.ovirt.engine.core.compat.Guid) DetachUserFromVmFromPoolParameters(org.ovirt.engine.core.common.action.DetachUserFromVmFromPoolParameters)

Aggregations

DetachUserFromVmFromPoolParameters (org.ovirt.engine.core.common.action.DetachUserFromVmFromPoolParameters)1 Permission (org.ovirt.engine.core.common.businessentities.Permission)1 VM (org.ovirt.engine.core.common.businessentities.VM)1 Guid (org.ovirt.engine.core.compat.Guid)1