Commit 1a9a4514 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '1527-removing-creator' into 'devel_16.0.x'

Resolve "removing creator of project might remove project background in projects created by user"

See merge request !1336
parents 8e4031af a932f76d
Pipeline #46582 passed with stage
in 36 minutes and 40 seconds
minerva (16.0.0~beta.2) stable; urgency=medium
* Bug fix: problem with export map with submaps fixed (#1540)
* Bug fix: removing user removed backgrounds in projects created by user
(#1527)
-- Piotr Gawron <piotr.gawron@uni.lu> Fri, 3 Sep 2021 11:00:00 +0200
......
package lcsb.mapviewer.api.users;
import java.io.IOException;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TreeMap;
import javax.mail.MessagingException;
......@@ -17,17 +27,33 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.MultiValueMap;
import lcsb.mapviewer.api.*;
import lcsb.mapviewer.api.BaseRestImpl;
import lcsb.mapviewer.api.OperationNotAllowedException;
import lcsb.mapviewer.api.UpdateConflictException;
import lcsb.mapviewer.common.Configuration;
import lcsb.mapviewer.common.exception.InvalidArgumentException;
import lcsb.mapviewer.common.exception.InvalidStateException;
import lcsb.mapviewer.model.map.MiriamType;
import lcsb.mapviewer.model.map.layout.ProjectBackground;
import lcsb.mapviewer.model.security.Privilege;
import lcsb.mapviewer.model.security.PrivilegeType;
import lcsb.mapviewer.model.user.*;
import lcsb.mapviewer.model.user.annotator.*;
import lcsb.mapviewer.services.*;
import lcsb.mapviewer.model.user.AnnotatorParamDefinition;
import lcsb.mapviewer.model.user.ConfigurationElementType;
import lcsb.mapviewer.model.user.User;
import lcsb.mapviewer.model.user.UserAnnotationSchema;
import lcsb.mapviewer.model.user.UserClassAnnotators;
import lcsb.mapviewer.model.user.UserClassRequiredAnnotations;
import lcsb.mapviewer.model.user.UserClassValidAnnotations;
import lcsb.mapviewer.model.user.UserGuiPreference;
import lcsb.mapviewer.model.user.annotator.AnnotatorConfigParameter;
import lcsb.mapviewer.model.user.annotator.AnnotatorData;
import lcsb.mapviewer.model.user.annotator.AnnotatorInputParameter;
import lcsb.mapviewer.model.user.annotator.AnnotatorOutputParameter;
import lcsb.mapviewer.model.user.annotator.AnnotatorParameter;
import lcsb.mapviewer.model.user.annotator.BioEntityField;
import lcsb.mapviewer.services.InvalidTokenException;
import lcsb.mapviewer.services.ObjectExistsException;
import lcsb.mapviewer.services.ObjectNotFoundException;
import lcsb.mapviewer.services.QueryException;
import lcsb.mapviewer.services.interfaces.IProjectBackgroundService;
import lcsb.mapviewer.services.utils.EmailSender;
......@@ -750,10 +776,6 @@ public class UserRestImpl extends BaseRestImpl {
} else if (user.getLogin().equals(Configuration.ANONYMOUS_LOGIN)) {
throw new OperationNotAllowedException("guest account cannot be removed");
}
List<ProjectBackground> backgrounds = projectBackgroundService.getProjectBackgroundsByUser(user);
for (ProjectBackground background : backgrounds) {
projectBackgroundService.removeProjectBackground(background, null);
}
getUserService().deleteUser(user);
return okStatus();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment