added support for new user site registration email to Site Managers
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/liferay62-plugins/landing-page-library@129955 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
eb49980c5a
commit
f44a79de76
27
pom.xml
27
pom.xml
|
@ -18,24 +18,41 @@
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<liferay.version>6.2.5</liferay.version>
|
<liferay.version>6.2.5</liferay.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.distribution</groupId>
|
||||||
|
<artifactId>maven-portal-bom</artifactId>
|
||||||
|
<version>LATEST</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.common.portal</groupId>
|
||||||
|
<artifactId>portal-manager</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.portal</groupId>
|
||||||
|
<artifactId>notifications-common-library</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.liferay.portal</groupId>
|
<groupId>com.liferay.portal</groupId>
|
||||||
<artifactId>portal-service</artifactId>
|
<artifactId>portal-service</artifactId>
|
||||||
<version>${liferay.version}</version>
|
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.liferay.portal</groupId>
|
<groupId>com.liferay.portal</groupId>
|
||||||
<artifactId>util-java</artifactId>
|
<artifactId>util-java</artifactId>
|
||||||
<version>${liferay.version}</version>
|
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.portlet</groupId>
|
<groupId>javax.portlet</groupId>
|
||||||
<artifactId>portlet-api</artifactId>
|
<artifactId>portlet-api</artifactId>
|
||||||
<version>2.0</version>
|
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -53,12 +70,10 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-log4j12</artifactId>
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
<version>1.6.4</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<version>1.6.4</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -5,6 +5,8 @@ import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import org.gcube.common.portal.PortalContext;
|
||||||
|
import org.gcube.portal.notifications.thread.NewUserSiteRegistrationNotificationThread;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -33,7 +35,7 @@ public class LandingPageManager {
|
||||||
public static final String GUEST_GROUP_FRIENDLY_URL = "/guest";
|
public static final String GUEST_GROUP_FRIENDLY_URL = "/guest";
|
||||||
public static final String PRIVATE_GROUP_SERVLET_MAPPING = PropsUtil.get(PropsKeys.LAYOUT_FRIENDLY_URL_PRIVATE_GROUP_SERVLET_MAPPING);
|
public static final String PRIVATE_GROUP_SERVLET_MAPPING = PropsUtil.get(PropsKeys.LAYOUT_FRIENDLY_URL_PRIVATE_GROUP_SERVLET_MAPPING);
|
||||||
public static final String PORTAL_CONTEXT = PortalUtil.getPathContext();
|
public static final String PORTAL_CONTEXT = PortalUtil.getPathContext();
|
||||||
|
|
||||||
public static String getLandingPagePath(final HttpServletRequest request) throws PortalException, SystemException {
|
public static String getLandingPagePath(final HttpServletRequest request) throws PortalException, SystemException {
|
||||||
User currentUser = PortalUtil.getUser(request);
|
User currentUser = PortalUtil.getUser(request);
|
||||||
return getLandingPagePath(request, currentUser);
|
return getLandingPagePath(request, currentUser);
|
||||||
|
@ -70,9 +72,11 @@ public class LandingPageManager {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! isRegistered)
|
if (! isRegistered) {
|
||||||
_log.debug("But user " + currentUser.getFullName() + " is not registered to " + site.getName() + ". going to register ...");
|
_log.debug("But user " + currentUser.getFullName() + " is not registered to " + site.getName() + ". going to register ...");
|
||||||
registerUserToSite(currentUser, site);
|
String portalURL = PortalContext.getConfiguration().getGatewayURL(request);
|
||||||
|
registerUserToSite(currentUser, site, portalURL);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,6 +87,7 @@ public class LandingPageManager {
|
||||||
}
|
}
|
||||||
return sitePath;
|
return sitePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this method is used to register the user to the group if does not belong to it yet
|
* this method is used to register the user to the group if does not belong to it yet
|
||||||
* IMPORTANT: it does not add the user to the Site's private pages if the Site Membership type is different from Private
|
* IMPORTANT: it does not add the user to the Site's private pages if the Site Membership type is different from Private
|
||||||
|
@ -90,9 +95,11 @@ public class LandingPageManager {
|
||||||
* @param site
|
* @param site
|
||||||
* @throws SystemException
|
* @throws SystemException
|
||||||
*/
|
*/
|
||||||
private static void registerUserToSite(User user, Group site) throws SystemException {
|
private static void registerUserToSite(User user, Group site, String siteURL) throws SystemException {
|
||||||
UserLocalServiceUtil.addGroupUser(site.getGroupId(), user.getUserId());
|
UserLocalServiceUtil.addGroupUser(site.getGroupId(), user.getUserId());
|
||||||
_log.debug("User " + user.getScreenName() +" registered to " + site.getName());
|
_log.debug("User " + user.getScreenName() +" registered to " + site.getName());
|
||||||
|
Thread emailSiteManagersThread = new Thread(new NewUserSiteRegistrationNotificationThread(user, site, siteURL));
|
||||||
|
emailSiteManagersThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Group> getSites(final long userId) throws PortalException, SystemException {
|
public static List<Group> getSites(final long userId) throws PortalException, SystemException {
|
||||||
|
|
Loading…
Reference in New Issue