Skip to content
Snippets Groups Projects
Commit 2e4f8795 authored by piotr.kupczyk@id.ethz.ch's avatar piotr.kupczyk@id.ethz.ch
Browse files

SSDM-10270 : add option to re-activate users from UI - update UserManager -...

SSDM-10270 : add option to re-activate users from UI - update UserManager - prior version of PersonUpdate had active flag set to true by default which was triggering person activation on every person update; now after the change of PersonUpdate the activation/deactivation is done only if explicitly requested; due to this change UserManager had to be updated to explicitly activate users when needed.
parent a2536952
No related branches found
No related tags found
No related merge requests found
......@@ -63,6 +63,7 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.person.id.IPersonId;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.person.id.PersonPermId;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.person.search.PersonSearchCriteria;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.person.update.PersonUpdate;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.person.update.UpdatePersonsOperation;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.project.create.CreateProjectsOperation;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.project.create.ProjectCreation;
import ch.ethz.sis.openbis.generic.asapi.v3.dto.project.fetchoptions.ProjectFetchOptions;
......@@ -623,6 +624,11 @@ public class UserManager
context.getReport().addUser(userId);
} else if (knownUser != null && knownUser.isActive() == false)
{
PersonUpdate personUpdate = new PersonUpdate();
personUpdate.setUserId(personId);
personUpdate.activate();
context.add(personUpdate);
context.getReport().reuseUser(userId);
}
getHomeSpaceRequest(userId).setHomeSpace(userSpaceId);
......@@ -1003,6 +1009,8 @@ public class UserManager
private Map<String, PersonCreation> personCreations = new LinkedMap<>();
private Map<IPersonId, PersonUpdate> personUpdates = new LinkedMap<>();
private List<SpaceCreation> spaceCreations = new ArrayList<>();
private List<ProjectCreation> projectCreations = new ArrayList<>();
......@@ -1053,6 +1061,11 @@ public class UserManager
personCreations.put(personCreation.getUserId(), personCreation);
}
public void add(PersonUpdate personUpdate)
{
personUpdates.put(personUpdate.getUserId(), personUpdate);
}
public void add(SpaceCreation spaceCreation)
{
spaceCreations.add(spaceCreation);
......@@ -1100,6 +1113,10 @@ public class UserManager
{
operations.add(new CreatePersonsOperation(new ArrayList<>(personCreations.values())));
}
if (personUpdates.isEmpty() == false)
{
operations.add(new UpdatePersonsOperation(new ArrayList<>(personUpdates.values())));
}
if (spaceCreations.isEmpty() == false)
{
operations.add(new CreateSpacesOperation(spaceCreations));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment