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);
}
Aggregations