Task #19812
This commit is contained in:
parent
6529b999f1
commit
085fe4e5c7
16
.classpath
16
.classpath
|
@ -1,12 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/create-users-portlet-2.5.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/create-users-portlet-3.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="target/create-users-portlet-2.5.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
<classpathentry excluding="**" kind="src" output="target/create-users-portlet-3.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
@ -18,11 +18,6 @@
|
||||||
<attribute name="test" value="true"/>
|
<attribute name="test" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
@ -36,5 +31,10 @@
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
|
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
|
||||||
<classpathentry kind="output" path="target/create-users-portlet-2.5.0-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="output" path="target/create-users-portlet-3.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
lastWarOutDir=/Users/massi/workspace/create-users-portlet/target/create-users-portlet-2.5.0-SNAPSHOT
|
lastWarOutDir=/Users/massi/workspace/create-users-portlet/target/create-users-portlet-3.0.0-SNAPSHOT
|
||||||
warSrcDir=src/main/webapp
|
warSrcDir=src/main/webapp
|
||||||
warSrcDirIsOutput=false
|
warSrcDirIsOutput=false
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
org.eclipse.jdt.core.compiler.release=disabled
|
org.eclipse.jdt.core.compiler.release=disabled
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<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/java"/>
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||||
|
<dependent-module archiveName="email-templates-library-1.4.2.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="java-output-path" value="/create-users/target/subscribe-users-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
<property name="context-root" value="create-users-portlet"/>
|
<property name="context-root" value="create-users-portlet"/>
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<faceted-project>
|
<faceted-project>
|
||||||
<fixed facet="wst.jsdt.web"/>
|
<fixed facet="wst.jsdt.web"/>
|
||||||
<installed facet="java" version="1.7"/>
|
|
||||||
<installed facet="jst.web" version="3.0"/>
|
<installed facet="jst.web" version="3.0"/>
|
||||||
<installed facet="wst.jsdt.web" version="1.0"/>
|
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||||
<installed facet="jst.jaxrs" version="2.0"/>
|
<installed facet="jst.jaxrs" version="2.0"/>
|
||||||
<installed facet="liferay.portlet" version="6.0"/>
|
<installed facet="liferay.portlet" version="6.0"/>
|
||||||
<installed facet="com.gwtplugins.gwt.facet" version="1.0"/>
|
<installed facet="com.gwtplugins.gwt.facet" version="1.0"/>
|
||||||
|
<installed facet="java" version="1.8"/>
|
||||||
</faceted-project>
|
</faceted-project>
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
# Changelog for invites-common-livrary
|
||||||
|
|
||||||
|
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.0-SNAPSHOT] - 2020-09-24
|
||||||
|
|
||||||
|
Ported to git
|
||||||
|
|
||||||
|
[#19812] modified to support the new IAM Keycloak based
|
||||||
|
|
||||||
|
|
||||||
|
## [v1.0.0] - 2016-03-28
|
||||||
|
|
||||||
|
First release, for changes between 1.0 version and 3 see changelog xml in distro folder.
|
|
@ -1,32 +0,0 @@
|
||||||
<assembly
|
|
||||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
|
||||||
<id>servicearchive</id>
|
|
||||||
<formats>
|
|
||||||
<format>tar.gz</format>
|
|
||||||
</formats>
|
|
||||||
<baseDirectory>/</baseDirectory>
|
|
||||||
<fileSets>
|
|
||||||
<fileSet>
|
|
||||||
<directory>${distroDirectory}</directory>
|
|
||||||
<outputDirectory>/</outputDirectory>
|
|
||||||
<useDefaultExcludes>true</useDefaultExcludes>
|
|
||||||
<includes>
|
|
||||||
<include>README</include>
|
|
||||||
<include>LICENSE</include>
|
|
||||||
<include>changelog.xml</include>
|
|
||||||
<include>profile.xml</include>
|
|
||||||
</includes>
|
|
||||||
<fileMode>755</fileMode>
|
|
||||||
<filtered>true</filtered>
|
|
||||||
</fileSet>
|
|
||||||
</fileSets>
|
|
||||||
<files>
|
|
||||||
<file>
|
|
||||||
<source>target/${build.finalName}.${project.packaging}</source>
|
|
||||||
<outputDirectory>/${artifactId}</outputDirectory>
|
|
||||||
</file>
|
|
||||||
|
|
||||||
</files>
|
|
||||||
</assembly>
|
|
|
@ -1,25 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
||||||
<ID></ID>
|
|
||||||
<Type>Service</Type>
|
|
||||||
<Profile>
|
|
||||||
<Description>${description}</Description>
|
|
||||||
<Class>PortletUser</Class>
|
|
||||||
<Name>${artifactId}</Name>
|
|
||||||
<Version>${version}</Version>
|
|
||||||
<Packages>
|
|
||||||
<Software>
|
|
||||||
<Name>${artifactId}</Name>
|
|
||||||
<Version>${version}</Version>
|
|
||||||
<MavenCoordinates>
|
|
||||||
<groupId>${groupId}</groupId>
|
|
||||||
<artifactId>${artifactId}</artifactId>
|
|
||||||
<version>${version}</version>
|
|
||||||
</MavenCoordinates>
|
|
||||||
<Files>
|
|
||||||
<File>target/${build.finalName}.war</File>
|
|
||||||
</Files>
|
|
||||||
</Software>
|
|
||||||
</Packages>
|
|
||||||
</Profile>
|
|
||||||
</Resource>
|
|
14
pom.xml
14
pom.xml
|
@ -13,7 +13,7 @@
|
||||||
<groupId>org.gcube.portlets.admin</groupId>
|
<groupId>org.gcube.portlets.admin</groupId>
|
||||||
<artifactId>create-users-portlet</artifactId>
|
<artifactId>create-users-portlet</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<version>2.5.0-SNAPSHOT</version>
|
<version>3.0.0-SNAPSHOT</version>
|
||||||
<name>Create users portlet</name>
|
<name>Create users portlet</name>
|
||||||
<description>
|
<description>
|
||||||
Create users portlet allows a VRE-Manager to enter user's personal data and automatically register he/she in the portal.
|
Create users portlet allows a VRE-Manager to enter user's personal data and automatically register he/she in the portal.
|
||||||
|
@ -28,10 +28,10 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<!-- Convenience property to set the GWT version -->
|
<!-- Convenience property to set the GWT version -->
|
||||||
<gwtVersion>2.7.0</gwtVersion>
|
<gwtVersion>2.8.2</gwtVersion>
|
||||||
<distroDirectory>distro</distroDirectory>
|
<distroDirectory>distro</distroDirectory>
|
||||||
<liferay.version>6.2.5</liferay.version>
|
<liferay.version>6.2.5</liferay.version>
|
||||||
<maven.compiler.source>1.7</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.distribution</groupId>
|
<groupId>org.gcube.distribution</groupId>
|
||||||
<artifactId>maven-portal-bom</artifactId>
|
<artifactId>maven-portal-bom</artifactId>
|
||||||
<version>LATEST</version>
|
<version>3.6.0-SNAPSHOT</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -108,12 +108,6 @@
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
<version>${gwtVersion}</version>
|
<version>${gwtVersion}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.gwt</groupId>
|
|
||||||
<artifactId>gwt-dev</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
<version>${gwtVersion}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.gwtbootstrap</groupId>
|
<groupId>com.github.gwtbootstrap</groupId>
|
||||||
<artifactId>gwt-bootstrap</artifactId>
|
<artifactId>gwt-bootstrap</artifactId>
|
||||||
|
|
|
@ -62,8 +62,8 @@ public class AddUserForm extends Composite{
|
||||||
@UiField
|
@UiField
|
||||||
TextBox surnameTextbox;
|
TextBox surnameTextbox;
|
||||||
|
|
||||||
@UiField
|
// @UiField
|
||||||
TextBox companyTextbox;
|
// TextBox companyTextbox;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
AlertBlock errorBlock;
|
AlertBlock errorBlock;
|
||||||
|
@ -115,7 +115,7 @@ public class AddUserForm extends Composite{
|
||||||
String actualName = nameTextbox.getText().trim();
|
String actualName = nameTextbox.getText().trim();
|
||||||
String actualSurname = surnameTextbox.getText().trim();
|
String actualSurname = surnameTextbox.getText().trim();
|
||||||
String actualEmail = emailTextbox.getText().trim();
|
String actualEmail = emailTextbox.getText().trim();
|
||||||
String actualCompany = companyTextbox.getText().trim();
|
String actualCompany = "";//companyTextbox.getText().trim();
|
||||||
|
|
||||||
if(actualEmail.isEmpty() || !actualEmail.matches(EMAIL_PATTERN)){
|
if(actualEmail.isEmpty() || !actualEmail.matches(EMAIL_PATTERN)){
|
||||||
|
|
||||||
|
@ -262,10 +262,10 @@ public class AddUserForm extends Composite{
|
||||||
void onChangeSurnameTextbox(KeyUpEvent event){
|
void onChangeSurnameTextbox(KeyUpEvent event){
|
||||||
hideAlertBlocks();
|
hideAlertBlocks();
|
||||||
}
|
}
|
||||||
|
//
|
||||||
@UiHandler("companyTextbox")
|
// @UiHandler("companyTextbox")
|
||||||
void onChangeCompanyTextbox(KeyUpEvent event){
|
// void onChangeCompanyTextbox(KeyUpEvent event){
|
||||||
hideAlertBlocks();
|
// hideAlertBlocks();
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,11 +69,11 @@
|
||||||
b:id="surname" title="User's surname" ui:field="surnameTextbox" />
|
b:id="surname" title="User's surname" ui:field="surnameTextbox" />
|
||||||
</b:Controls>
|
</b:Controls>
|
||||||
|
|
||||||
<b:ControlLabel for="company" title="User's company">Institution/Organization:</b:ControlLabel>
|
<!-- <b:ControlLabel for="company" title="User's company">Institution/Organization:</b:ControlLabel> -->
|
||||||
<b:Controls>
|
<!-- <b:Controls> -->
|
||||||
<b:TextBox alternateSize="LARGE" placeholder="Institution/Organization"
|
<!-- <b:TextBox alternateSize="LARGE" placeholder="Institution/Organization" -->
|
||||||
b:id="company" title="User's Institution/Organization" ui:field="companyTextbox" />
|
<!-- b:id="company" title="User's Institution/Organization" ui:field="companyTextbox" /> -->
|
||||||
</b:Controls>
|
<!-- </b:Controls> -->
|
||||||
|
|
||||||
<b:ControlLabel for="sendmail"
|
<b:ControlLabel for="sendmail"
|
||||||
title="Send a notification mail to the user">Send mail:</b:ControlLabel>
|
title="Send a notification mail to the user">Send mail:</b:ControlLabel>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.gcube.portlets.admin.createusers.orchestrator;
|
package org.gcube.portlets.admin.createusers.orchestrator;
|
||||||
|
|
||||||
import org.gcube.portal.event.publisher.lr62.PortalEvent;
|
import org.gcube.portal.event.publisher.lr62.PortalEvent;
|
||||||
|
import org.gcube.portlets.admin.createusers.server.CreateUsersImpl;
|
||||||
|
|
||||||
import com.liferay.portal.kernel.exception.PortalException;
|
import com.liferay.portal.kernel.exception.PortalException;
|
||||||
import com.liferay.portal.kernel.exception.SystemException;
|
import com.liferay.portal.kernel.exception.SystemException;
|
||||||
|
@ -46,7 +47,7 @@ public class CreateUserAddToVre extends PortalEvent {
|
||||||
|
|
||||||
protected String computeUsername(String email) {
|
protected String computeUsername(String email) {
|
||||||
try {
|
try {
|
||||||
Long companyId = CompanyThreadLocal.getCompanyId();
|
Long companyId = CreateUsersImpl.getCompany().getCompanyId();
|
||||||
Long defaultUserId = UserLocalServiceUtil.getDefaultUserId(companyId);
|
Long defaultUserId = UserLocalServiceUtil.getDefaultUserId(companyId);
|
||||||
return defaultScreenNameGenerator.generate(companyId, defaultUserId, email);
|
return defaultScreenNameGenerator.generate(companyId, defaultUserId, email);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -8,13 +8,14 @@ import java.sql.Timestamp;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import org.gcube.common.portal.PortalContext;
|
import org.gcube.common.portal.PortalContext;
|
||||||
import org.gcube.portal.mailing.message.Recipient;
|
import org.gcube.portal.mailing.message.Recipient;
|
||||||
import org.gcube.portal.mailing.service.EmailTemplateService;
|
import org.gcube.portal.mailing.service.EmailTemplateService;
|
||||||
import org.gcube.portal.mailing.templates.TemplateWelcomeCreatedAccount;
|
import org.gcube.portal.mailing.templates.TemplateWelcomeCreatedAccount;
|
||||||
import org.gcube.portlets.admin.createusers.client.HandleUsersService;
|
import org.gcube.portlets.admin.createusers.client.HandleUsersService;
|
||||||
|
import org.gcube.portlets.admin.createusers.orchestrator.CreateUserAddToVre;
|
||||||
|
import org.gcube.portlets.admin.createusers.orchestrator.CreateUserAddToVrePublisher;
|
||||||
import org.gcube.portlets.admin.createusers.shared.VreUserBean;
|
import org.gcube.portlets.admin.createusers.shared.VreUserBean;
|
||||||
import org.gcube.vomanagement.usermanagement.UserManager;
|
import org.gcube.vomanagement.usermanagement.UserManager;
|
||||||
import org.gcube.vomanagement.usermanagement.exception.UserManagementPortalException;
|
import org.gcube.vomanagement.usermanagement.exception.UserManagementPortalException;
|
||||||
|
@ -33,11 +34,10 @@ import com.liferay.portal.kernel.exception.SystemException;
|
||||||
import com.liferay.portal.kernel.util.GetterUtil;
|
import com.liferay.portal.kernel.util.GetterUtil;
|
||||||
import com.liferay.portal.kernel.util.PropsUtil;
|
import com.liferay.portal.kernel.util.PropsUtil;
|
||||||
import com.liferay.portal.model.Company;
|
import com.liferay.portal.model.Company;
|
||||||
import com.liferay.portal.model.User;
|
import com.liferay.portal.model.Group;
|
||||||
import com.liferay.portal.service.CompanyLocalServiceUtil;
|
import com.liferay.portal.service.CompanyLocalServiceUtil;
|
||||||
import com.liferay.portal.service.ServiceContext;
|
import com.liferay.portal.service.GroupLocalServiceUtil;
|
||||||
import com.liferay.portal.service.UserLocalServiceUtil;
|
import com.liferay.portal.service.UserLocalServiceUtil;
|
||||||
import com.liferay.portal.util.PortalUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The server side implementation of the RPC service.
|
* The server side implementation of the RPC service.
|
||||||
|
@ -48,6 +48,8 @@ public class CreateUsersImpl extends RemoteServiceServlet implements HandleUsers
|
||||||
private final static Logger logger = LoggerFactory.getLogger(CreateUsersImpl.class);
|
private final static Logger logger = LoggerFactory.getLogger(CreateUsersImpl.class);
|
||||||
private static final long serialVersionUID = -3124676000683430170L;
|
private static final long serialVersionUID = -3124676000683430170L;
|
||||||
private static final String REGISTERED_USERS_TABLE = "registered_users";
|
private static final String REGISTERED_USERS_TABLE = "registered_users";
|
||||||
|
private static final String INITIAL_PWD = "training1";
|
||||||
|
|
||||||
|
|
||||||
// SQL TABLE FIELDS
|
// SQL TABLE FIELDS
|
||||||
private static final String FIELD_EMAIL = "email";
|
private static final String FIELD_EMAIL = "email";
|
||||||
|
@ -233,15 +235,16 @@ public class CreateUsersImpl extends RemoteServiceServlet implements HandleUsers
|
||||||
int res = statement.executeUpdate();
|
int res = statement.executeUpdate();
|
||||||
if(res != 0){
|
if(res != 0){
|
||||||
logger.debug("User added in " + REGISTERED_USERS_TABLE);
|
logger.debug("User added in " + REGISTERED_USERS_TABLE);
|
||||||
// add in liferay too
|
// add in Keycloak too
|
||||||
try{
|
try{
|
||||||
User user = register(name, surname, email, institution, sendEmail);
|
logger.debug("trying to send the event to create the account for this user to the orchestrator");
|
||||||
// adding to the current VRE
|
long currGroupId = pContext.getCurrentGroupId(getThreadLocalRequest());
|
||||||
long userId = userManager.getUserId(user.getScreenName());
|
Group theVRE = GroupLocalServiceUtil.getGroup(currGroupId);
|
||||||
userManager.assignUserToGroup(getCurrentGroupID(), userId);
|
|
||||||
|
new CreateUserAddToVrePublisher().publish(
|
||||||
|
CreateUserAddToVre.newEvent(name, surname, email, INITIAL_PWD, theVRE));
|
||||||
if (sendEmail)
|
if (sendEmail)
|
||||||
sendEmailToUser(email);
|
sendEmailToUser(email);
|
||||||
|
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
|
|
||||||
// unable to create.. we need to delete it from the list of users
|
// unable to create.. we need to delete it from the list of users
|
||||||
|
@ -273,74 +276,7 @@ public class CreateUsersImpl extends RemoteServiceServlet implements HandleUsers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private User register(String firstName, String lastName, String email, String institution, boolean sendEmail) {
|
|
||||||
User toReturn = null;
|
|
||||||
try{
|
|
||||||
logger.debug("Trying createuser and instatiate serviceContext" + email);
|
|
||||||
Long defaultCompanyId = PortalUtil.getDefaultCompanyId();
|
|
||||||
Long defaultUserId = UserLocalServiceUtil.getDefaultUserId(defaultCompanyId);
|
|
||||||
PortalContext pContext = PortalContext.getConfiguration();
|
|
||||||
//ServiceContext instanciated as follows is needed when the Email verification is sent
|
|
||||||
ServiceContext serviceContext = new ServiceContext();
|
|
||||||
serviceContext.setScopeGroupId(pContext.getCurrentGroupId(getThreadLocalRequest()));
|
|
||||||
serviceContext.setPortalURL(pContext.getGatewayURL(getThreadLocalRequest()));
|
|
||||||
serviceContext.setPathMain("/c");
|
|
||||||
|
|
||||||
boolean autoPassword = false;
|
|
||||||
Locale locale = new Locale("en_US");
|
|
||||||
int prefixId = 0;
|
|
||||||
int suffixId = 0;
|
|
||||||
int birthdayMonth = 1;
|
|
||||||
int birthdayDay = 1;
|
|
||||||
int birthdayYear = 1970;
|
|
||||||
String password1 = "training1";
|
|
||||||
String password2 = password1;
|
|
||||||
toReturn = UserLocalServiceUtil.addUser(
|
|
||||||
defaultUserId,
|
|
||||||
defaultCompanyId,
|
|
||||||
autoPassword,
|
|
||||||
password1,
|
|
||||||
password2,
|
|
||||||
true,
|
|
||||||
"",
|
|
||||||
email,
|
|
||||||
0L,
|
|
||||||
"",
|
|
||||||
locale,
|
|
||||||
firstName,
|
|
||||||
"",
|
|
||||||
lastName,
|
|
||||||
prefixId,
|
|
||||||
suffixId,
|
|
||||||
true,
|
|
||||||
birthdayMonth,
|
|
||||||
birthdayDay,
|
|
||||||
birthdayYear,
|
|
||||||
institution,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
false,
|
|
||||||
serviceContext);
|
|
||||||
logger.debug("CreateUser " + lastName + " SUCCESS");
|
|
||||||
UserLocalServiceUtil.updateEmailAddressVerified(toReturn.getUserId(), true);
|
|
||||||
UserLocalServiceUtil.updateAgreedToTermsOfUse(toReturn.getUserId(), false);
|
|
||||||
UserLocalServiceUtil.updatePasswordReset(toReturn.getUserId(), true);
|
|
||||||
UserLocalServiceUtil.updateReminderQuery(toReturn.getUserId(), "What was your initial password?", "training1");
|
|
||||||
logger.debug("User " + lastName + " has agreed to ToU");
|
|
||||||
logger.debug("User " + lastName + " has verified the Email");
|
|
||||||
logger.debug("User " + lastName + " updatePasswordReset & updateReminderQuery");
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
catch(Exception e){
|
|
||||||
// unable to create.. we need to delete it from the list of users
|
|
||||||
logger.error("Unable to create the user " + email + " in liferay.", e);
|
|
||||||
|
|
||||||
}
|
|
||||||
return toReturn;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<VreUserBean> getAlreadyRegisterdUsers() {
|
public List<VreUserBean> getAlreadyRegisterdUsers() {
|
||||||
|
|
Loading…
Reference in New Issue