Compare commits

...

7 Commits

6 changed files with 87 additions and 55 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/create-users-portlet-3.0.0/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/create-users-portlet-3.0.1/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/create-users-portlet-3.0.0/WEB-INF/classes" path="src/main/resources">
<classpathentry excluding="**" kind="src" output="target/create-users-portlet-3.0.1/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
@ -36,5 +36,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/create-users-portlet-3.0.0/WEB-INF/classes"/>
<classpathentry kind="output" path="target/create-users-portlet-3.0.1/WEB-INF/classes"/>
</classpath>

View File

@ -1,57 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="create-users-portlet">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="email-templates-library-1.4.4.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/email-templates-library/email-templates-library">
<dependent-module archiveName="email-templates-library-1.5.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/email-templates-library/email-templates-library">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="/create-users/target/subscribe-users-1.0.0-SNAPSHOT/WEB-INF/classes"/>
<property name="context-root" value="create-users-portlet"/>
</wb-module>

View File

@ -1,15 +1,23 @@
# Changelog for invites-common-livrary
# Changelog for create-users-portlet
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v3.0.2] - 2022-06-08
- Released for HL removal in portal
## [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
Ported to git
- Ported to git
[#19812] modified to support the new IAM Keycloak based
- #19812 modified to support the new IAM Keycloak based
## [v1.0.0] - 2016-03-28

View File

@ -23,30 +23,20 @@ See [Releases](https://code-repo.d4science.org/gCubeSystem/my-vres/releases).
## Authors
* **Costantino Perciante** - [ISTI-CNR Infrascience Group](http://nemis.isti.cnr.it/groups/infrascience)
* **Massimiliano Assante** - [ISTI-CNR Infrascience Group](http://nemis.isti.cnr.it/groups/infrascience)
* **Massimiliano Assante** ([ORCID](https://orcid.org/0000-0002-3761-1492)) - [ISTI-CNR Infrascience Group](https://www.isti.cnr.it/People/M.Assante)
## Maintainers
* **Massimiliano Assante** - [ISTI-CNR Infrascience Group](http://nemis.isti.cnr.it/groups/infrascience)
* **Massimiliano Assante** ([ORCID](https://orcid.org/0000-0002-3761-1492)) - [ISTI-CNR Infrascience Group](https://www.isti.cnr.it/People/M.Assante)
## License
This project is licensed under the EUPL V.1.1 License - see the [LICENSE.md](LICENSE.md) file for details.
## About the gCube Framework
This software is part of the [gCubeFramework](https://www.gcube-system.org/ "gCubeFramework"): an
open-source software toolkit used for building and operating Hybrid Data
Infrastructures enabling the dynamic deployment of Virtual Research Environments
by favouring the realisation of reuse oriented policies.
The projects leading to this software have received funding from a series of European Union programmes including:
- the Sixth Framework Programme for Research and Technological Development
- DILIGENT (grant no. 004260);
- the Seventh Framework Programme for research, technological development and demonstration
- D4Science (grant no. 212488), D4Science-II (grant no.239019), ENVRI (grant no. 283465), EUBrazilOpenBio (grant no. 288754), iMarine(grant no. 283644);
- the H2020 research and innovation programme
- BlueBRIDGE (grant no. 675680), EGIEngage (grant no. 654142), ENVRIplus (grant no. 654182), Parthenos (grant no. 654119), SoBigData (grant no. 654024),DESIRA (grant no. 818194), ARIADNEplus (grant no. 823914), RISIS2 (grant no. 824091), PerformFish (grant no. 727610), AGINFRAplus (grant no. 731001);
The projects leading to this software have received funding from a series of European Union programmes see [FUNDING.md](FUNDING.md)

10
pom.xml
View File

@ -13,7 +13,7 @@
<groupId>org.gcube.portlets.admin</groupId>
<artifactId>create-users-portlet</artifactId>
<packaging>war</packaging>
<version>3.0.0</version>
<version>3.0.2</version>
<name>Create users portlet</name>
<description>
Create users portlet allows a VRE-Manager to enter user's personal data and automatically register he/she in the portal.
@ -31,10 +31,7 @@
<gwtVersion>2.8.2</gwtVersion>
<distroDirectory>distro</distroDirectory>
<liferay.version>6.2.5</liferay.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
@ -51,7 +48,7 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>3.6.0</version>
<version>3.6.4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -62,13 +59,11 @@
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>event-publisher-library</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>event-publisher-portal</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -78,7 +73,6 @@
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>oidc-library-portal</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -1,7 +1,6 @@
package org.gcube.portlets.admin.createusers.server;
import static org.gcube.common.authorization.client.Constants.authorizationService;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@ -13,12 +12,10 @@ import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import org.gcube.common.authorization.library.provider.AccessTokenProvider;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.authorization.library.provider.UmaJWTProvider;
import org.gcube.common.portal.PortalContext;
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
import org.gcube.common.storagehub.client.plugins.AbstractPlugin;
import org.gcube.common.storagehub.client.proxies.UserManagerClient;
import org.gcube.portal.mailing.message.Recipient;
import org.gcube.portal.mailing.service.EmailTemplateService;
import org.gcube.portal.mailing.templates.TemplateWelcomeCreatedAccount;
@ -241,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){
@ -282,7 +283,7 @@ public class CreateUsersImpl extends RemoteServiceServlet implements HandleUsers
private boolean workspaceExists(String usernameToCheck) {
String previousToken = SecurityTokenProvider.instance.get();
String previousUMAToken = UmaJWTProvider.instance.get();
String previousUMAToken = AccessTokenProvider.instance.get();
boolean toReturn = false;
try {
//get the super user
@ -313,11 +314,11 @@ public class CreateUsersImpl extends RemoteServiceServlet implements HandleUsers
StorageHubClient shc = new StorageHubClient();
toReturn = shc.userExists(usernameToCheck);
logger.info("\nshub userExists(" + usernameToCheck + ") returns "+toReturn);
UmaJWTProvider.instance.set(previousUMAToken);
AccessTokenProvider.instance.set(previousUMAToken);
SecurityTokenProvider.instance.set(previousToken);
return toReturn;
} catch (Exception e) {
UmaJWTProvider.instance.set(previousUMAToken);
AccessTokenProvider.instance.set(previousUMAToken);
SecurityTokenProvider.instance.set(previousToken);
logger.error("Cannot check if worspace exists for " + usernameToCheck, e);
return false;