From 9ca0963b765eb3b8b1c9d5529c2b171070508997 Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Tue, 13 Jul 2021 17:11:25 +0200 Subject: [PATCH] fix #21803, create-user-portlet may notcreated user to all contexts --- CHANGELOG.md | 1 + .../admin/createusers/server/CreateUsersImpl.java | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a29416c..84e1c51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [v3.0.1] - 2021-07-08 - Feature #21777, migrated to new AccessTokenProvider class +- Bug fix #21803, create-user-portlet may not add the yet created user to all the context at once ## [v3.0.0] - 2020-09-24 diff --git a/src/main/java/org/gcube/portlets/admin/createusers/server/CreateUsersImpl.java b/src/main/java/org/gcube/portlets/admin/createusers/server/CreateUsersImpl.java index 15671d3..c5ced36 100644 --- a/src/main/java/org/gcube/portlets/admin/createusers/server/CreateUsersImpl.java +++ b/src/main/java/org/gcube/portlets/admin/createusers/server/CreateUsersImpl.java @@ -238,12 +238,16 @@ public class CreateUsersImpl extends RemoteServiceServlet implements HandleUsers logger.info("Create workspace via shub has been done, proceed with user add to VRE"); // adding to the current VRE long userId = userManager.getUserId(user.getScreenName()); - userManager.assignUserToGroup(getCurrentGroupID(), userId); - logger.debug("trying to send the event to create the account for this user to the orchestrator"); + logger.info("trying to send the event to create the account for this user to the orchestrator"); long currGroupId = pContext.getCurrentGroupId(getThreadLocalRequest()); Group theVRE = GroupLocalServiceUtil.getGroup(currGroupId); new CreateUserAddToVrePublisher().publish( CreateUserAddToVre.newEvent(user.getScreenName(), name, surname, email, INITIAL_PWD, theVRE)); + logger.debug("... sleeping 5 seconds"); + Thread.sleep(5000); + logger.debug("... now adding his user to the VRE"); + userManager.assignUserToGroup(getCurrentGroupID(), userId); + if (sendEmail) sendEmailToUser(email, name + " " + surname); }catch(Exception e){