Massimiliano Assante 5 years ago
parent 4380cc01db
commit 5a0f03e7c1

@ -17,15 +17,15 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<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"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>

@ -38,5 +38,6 @@
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>com.liferay.ide.core.liferayNature</nature>
</natures>
</projectDescription>

@ -1,8 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.source=1.8

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="user-registration-hook">
<wb-module deploy-name="user-registration-hook-hook">
<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"/>

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.6"/>
<installed facet="jst.web" version="2.4"/>
<installed facet="liferay.hook" version="6.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="java" version="1.8"/>
</faceted-project>

@ -13,7 +13,7 @@
<artifactId>user-registration-hook</artifactId>
<packaging>war</packaging>
<name>user-registration-hook Hook</name>
<version>1.0.0-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
<build>
<plugins>
@ -35,8 +35,8 @@
<version>2.5</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.6</source>
<target>1.6</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
@ -65,6 +65,21 @@
<artifactId>notifications-common-library</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>home-library</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>home-library-jcr</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>home-library-model</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.dvos</groupId>
<artifactId>usermanagement-core</artifactId>
@ -120,8 +135,10 @@
<profile>
<id>Liferay-v6.2-CE-(Tomcat-7)-(2)</id>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<liferay.version>6.2.5</liferay.version>
<liferay.maven.plugin.version>6.2.5</liferay.maven.plugin.version>
<liferay.maven.plugin.version>6.2.10.12</liferay.maven.plugin.version>
<liferay.auto.deploy.dir>/Users/massi/portal/liferay-portal-6.2-ce-ga6/deploy</liferay.auto.deploy.dir>
<liferay.app.server.deploy.dir>/Users/massi/portal/liferay-portal-6.2-ce-ga6/tomcat-7.0.62/webapps</liferay.app.server.deploy.dir>
<liferay.app.server.lib.global.dir>/Users/massi/portal/liferay-portal-6.2-ce-ga6/tomcat-7.0.62/lib/ext</liferay.app.server.lib.global.dir>

@ -26,6 +26,9 @@ public class MyCreateUserAccountListener extends BaseModelListener<User> {
_log.info("onAfterCreate NewUserAccount listener for: " + user.getScreenName() + " / " + user.getFullName());
Thread emailManagersThread = new Thread(new NewUserAccountNotificationThread(user.getScreenName(), user.getFullName(), user.getEmailAddress()));
emailManagersThread.start();
Thread WorkspaceAccountCreationThread = new Thread(new WorkspaceCreateAccountThread(user.getScreenName(), user.getFullName(), user.getEmailAddress()));
WorkspaceAccountCreationThread.start();
}

@ -0,0 +1,43 @@
package org.gcube.portal.usersaccount;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.homelibrary.home.HomeLibrary;
import org.gcube.common.homelibrary.home.workspace.Workspace;
import org.gcube.common.portal.PortalContext;
import org.gcube.common.scope.api.ScopeProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class WorkspaceCreateAccountThread implements Runnable {
private static Logger _log = LoggerFactory.getLogger(WorkspaceCreateAccountThread.class);
private String newUserUserName;
public WorkspaceCreateAccountThread(String newUserUserName, String newUserFullName, String newUserEmailAddress) {
super();
this.newUserUserName = newUserUserName;
_log.info("Calling HomeLibrary for Workspace creation to new user: " + newUserUserName + " ("+newUserFullName+")");
}
@Override
public void run() {
getWS(newUserUserName, "/"+PortalContext.getConfiguration().getInfrastructureName());
}
public static Workspace getWS(String currentUsername, String context) {
String username = currentUsername;
String authorizationToken = PortalContext.getConfiguration().getCurrentUserToken(context, username);
SecurityTokenProvider.instance.set(authorizationToken);
ScopeProvider.instance.set(context);
try {
Workspace toReturn = HomeLibrary.getUserWorkspace(username);
_log.info("Done Workspace creation for user: " + currentUsername);
return toReturn;
}
catch (Exception e) {
e.printStackTrace();
return null;
}
}
}

@ -1,6 +1,6 @@
name=user-registration-hook
module-group-id=liferay
module-incremental-version=1
module-incremental-version=2
tags=
short-description=
change-log=

Loading…
Cancel
Save