diff --git a/pom.xml b/pom.xml
index 6eddb6a..c8611c4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,7 +12,7 @@
org.gcube.portal
invites-common-library
- 1.2.0-SNAPSHOT
+ 1.3.0-SNAPSHOT
jar
gCube Invites Common Library is a common library containing shared code for Inviting external users to portal VREs.
@@ -44,8 +44,8 @@
- org.gcube.portal
- custom-portal-handler
+ javax.servlet
+ javax.servlet-api
provided
@@ -68,22 +68,11 @@
jsoup
1.6.2
-
- org.gcube.applicationsupportlayer
- aslcore
- provided
-
org.gcube.portal
social-networking-library
provided
-
- javax.servlet
- servlet-api
- 2.4
- provided
-
com.sun.mail
javax.mail
diff --git a/src/main/java/org/gcube/portal/invites/InvitesManager.java b/src/main/java/org/gcube/portal/invites/InvitesManager.java
index c901e24..76fadd5 100644
--- a/src/main/java/org/gcube/portal/invites/InvitesManager.java
+++ b/src/main/java/org/gcube/portal/invites/InvitesManager.java
@@ -10,7 +10,6 @@ import java.util.UUID;
import javax.mail.internet.AddressException;
import javax.servlet.http.HttpServletRequest;
-import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.common.portal.PortalContext;
import org.gcube.common.portal.mailing.EmailNotification;
import org.gcube.portal.databook.server.DBCassandraAstyanaxImpl;
@@ -64,7 +63,6 @@ public class InvitesManager {
public InviteOperationResult sendInvite(
HttpServletRequest request,
- ASLSession aslSession,
String portalSenderEmail,
String portalURL,
String name,
@@ -72,18 +70,20 @@ public class InvitesManager {
String email,
String vreDescription) {
- String username = aslSession.getUsername();
- String fromFullName = aslSession.getUserFullName();
+ GCubeUser currUser = PortalContext.getConfiguration().getCurrentUser(request);
+ String username = currUser.getUsername();
+ String fromFullName = currUser.getFullname();
String controlcode = UUID.randomUUID().toString();
+ String currScope = PortalContext.getConfiguration().getCurrentScope(request);
- Invite invite = new Invite(UUID.randomUUID().toString(), username, aslSession.getScopeName(), email, controlcode, InviteStatus.PENDING, new Date(), fromFullName);
+ Invite invite = new Invite(UUID.randomUUID().toString(), username, currScope, email, controlcode, InviteStatus.PENDING, new Date(), fromFullName);
InviteOperationResult result = null;
boolean emailResult = false;
try {
- String vreName = aslSession.getGroupName();
+ String vreName = PortalContext.getConfiguration().getCurrentGroupName(request);
result = store.saveInvite(invite);
- emailResult = sendInviteEmail(request, aslSession, portalSenderEmail, portalURL, name, lastName, email, vreDescription);
- notifyInviteSent(request, username, aslSession.getScopeName(), invite, vreName);
+ emailResult = sendInviteEmail(request, vreName, portalSenderEmail, portalURL, name, lastName, email, vreDescription);
+ notifyInviteSent(request, username, currScope, invite, vreName);
} catch (AddressException e) {
_log.error("Email not valid " + e.getMessage());
@@ -96,7 +96,7 @@ public class InvitesManager {
private Boolean sendInviteEmail(
HttpServletRequest request,
- ASLSession aslSession,
+ String vreName,
String portalSenderEmail,
String portalURL,
String name,
@@ -104,21 +104,20 @@ public class InvitesManager {
String email,
String vreDescription) {
- String vreName = aslSession.getGroupName();
- String fromFullName = aslSession.getUserFullName();
-
+ GCubeUser currUser = PortalContext.getConfiguration().getCurrentUser(request);
+ String fromFullName = currUser.getFullname();
try {
String subject = "Join me on " + vreName;
- long groupId = aslSession.getGroupId();
+ long groupId = PortalContext.getConfiguration().getCurrentGroupId(request);
final String linkToAcceptInvite = portalURL + PortalContext.getConfiguration().getSiteLandingPagePath(request)+"/explore?siteId="+groupId;
final String linkToCreateAccount = portalURL + "/?p_p_id=58&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&saveLastPath=false&_58_struts_action=%2Flogin%2Fcreate_account";
EmailNotification mailToAdmin = new EmailNotification(
email ,
subject,
- getHTMLEmail(aslSession, name, lastName, email, fromFullName, vreName, vreDescription, linkToAcceptInvite, linkToCreateAccount),
+ getHTMLEmail(name, lastName, email, fromFullName, vreName, vreDescription, linkToAcceptInvite, linkToCreateAccount),
request);
mailToAdmin.sendEmail();
_log.debug("Sent message successfully to " + email );
@@ -143,7 +142,6 @@ public class InvitesManager {
* @return the email text
*/
private String getHTMLEmail(
- ASLSession aslSession,
String name,
String lastName,
String email,