diff --git a/.classpath b/.classpath index 0f4a4c2..26981b6 100644 --- a/.classpath +++ b/.classpath @@ -17,16 +17,16 @@ - - - - - + + + + + diff --git a/.project b/.project index 0d8b01b..1aa1c7a 100644 --- a/.project +++ b/.project @@ -38,5 +38,6 @@ org.eclipse.m2e.core.maven2Nature org.eclipse.wst.common.project.facet.core.nature org.eclipse.wst.jsdt.core.jsNature + com.liferay.ide.core.liferayNature diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 69c31cd..6e80039 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index eedc2aa..a2d46af 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,5 +1,5 @@ - + diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml index 1e1fabd..a2e86a5 100644 --- a/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -1,8 +1,8 @@ - + diff --git a/pom.xml b/pom.xml index 6df873b..f5e988d 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ user-registration-hook war user-registration-hook Hook - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT @@ -35,8 +35,8 @@ 2.5 UTF-8 - 1.6 - 1.6 + 1.8 + 1.8 @@ -65,6 +65,21 @@ notifications-common-library provided + + org.gcube.common + home-library + provided + + + org.gcube.common + home-library-jcr + provided + + + org.gcube.common + home-library-model + provided + org.gcube.dvos usermanagement-core @@ -120,8 +135,10 @@ Liferay-v6.2-CE-(Tomcat-7)-(2) + 1.8 + 1.8 6.2.5 - 6.2.5 + 6.2.10.12 /Users/massi/portal/liferay-portal-6.2-ce-ga6/deploy /Users/massi/portal/liferay-portal-6.2-ce-ga6/tomcat-7.0.62/webapps /Users/massi/portal/liferay-portal-6.2-ce-ga6/tomcat-7.0.62/lib/ext diff --git a/src/main/java/org/gcube/portal/usersaccount/MyCreateUserAccountListener.java b/src/main/java/org/gcube/portal/usersaccount/MyCreateUserAccountListener.java index 986514e..d1c519c 100644 --- a/src/main/java/org/gcube/portal/usersaccount/MyCreateUserAccountListener.java +++ b/src/main/java/org/gcube/portal/usersaccount/MyCreateUserAccountListener.java @@ -26,6 +26,9 @@ public class MyCreateUserAccountListener extends BaseModelListener { _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(); } diff --git a/src/main/java/org/gcube/portal/usersaccount/WorkspaceCreateAccountThread.java b/src/main/java/org/gcube/portal/usersaccount/WorkspaceCreateAccountThread.java new file mode 100644 index 0000000..296acfb --- /dev/null +++ b/src/main/java/org/gcube/portal/usersaccount/WorkspaceCreateAccountThread.java @@ -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; + } + } +} + + + diff --git a/src/main/webapp/WEB-INF/liferay-plugin-package.properties b/src/main/webapp/WEB-INF/liferay-plugin-package.properties index d9ce867..272a653 100644 --- a/src/main/webapp/WEB-INF/liferay-plugin-package.properties +++ b/src/main/webapp/WEB-INF/liferay-plugin-package.properties @@ -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=