Compatible with social model 2.0.0
This commit is contained in:
parent
24207fd25a
commit
7db32a5748
|
@ -6,9 +6,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||||
|
|
||||||
## [v1.5.1] - 2020-07-21
|
## [v1.5.1] - 2020-07-21
|
||||||
|
|
||||||
Ported to git
|
- Ported to git
|
||||||
|
- Feature #19708 send a temporary password in the invite email if the account does not exists
|
||||||
Feature #19708 send a temporary password in the invite email if the account does not exists
|
- Feature #26539 removed social networking library dependency
|
||||||
|
|
||||||
## [v1.5.0] - 2017-11-29
|
## [v1.5.0] - 2017-11-29
|
||||||
|
|
||||||
|
|
11
pom.xml
11
pom.xml
|
@ -71,9 +71,16 @@
|
||||||
<artifactId>jsoup</artifactId>
|
<artifactId>jsoup</artifactId>
|
||||||
<version>1.6.2</version>
|
<version>1.6.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--needs to be provided -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portal</groupId>
|
<groupId>org.gcube.social-networking</groupId>
|
||||||
<artifactId>social-networking-library</artifactId>
|
<artifactId>social-service-model</artifactId>
|
||||||
|
<version>[1.2.0-SNAPSHOT, 2.0.0)</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.social-networking</groupId>
|
||||||
|
<artifactId>social-service-client</artifactId>
|
||||||
|
<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -13,13 +13,12 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.gcube.common.portal.PortalContext;
|
import org.gcube.common.portal.PortalContext;
|
||||||
import org.gcube.portal.databook.server.DBCassandraAstyanaxImpl;
|
import org.gcube.social_networking.social_networking_client_library.LibClient;
|
||||||
import org.gcube.portal.databook.server.DatabookStore;
|
import org.gcube.social_networking.socialnetworking.model.shared.Invite;
|
||||||
import org.gcube.portal.databook.shared.Invite;
|
import org.gcube.social_networking.socialnetworking.model.shared.InviteOperationResult;
|
||||||
import org.gcube.portal.databook.shared.InviteOperationResult;
|
import org.gcube.social_networking.socialnetworking.model.shared.InviteStatus;
|
||||||
import org.gcube.portal.databook.shared.InviteStatus;
|
import org.gcube.social_networking.socialnetworking.model.shared.exceptions.InviteIDNotFoundException;
|
||||||
import org.gcube.portal.databook.shared.ex.InviteIDNotFoundException;
|
import org.gcube.social_networking.socialnetworking.model.shared.exceptions.InviteStatusNotFoundException;
|
||||||
import org.gcube.portal.databook.shared.ex.InviteStatusNotFoundException;
|
|
||||||
import org.gcube.portal.mailing.message.EmailAddress;
|
import org.gcube.portal.mailing.message.EmailAddress;
|
||||||
import org.gcube.portal.mailing.message.Recipient;
|
import org.gcube.portal.mailing.message.Recipient;
|
||||||
import org.gcube.portal.mailing.message.RecipientType;
|
import org.gcube.portal.mailing.message.RecipientType;
|
||||||
|
@ -52,7 +51,7 @@ public class InvitesManager {
|
||||||
|
|
||||||
|
|
||||||
private static InvitesManager instance;
|
private static InvitesManager instance;
|
||||||
private static DatabookStore store;
|
private static LibClient libClient;
|
||||||
|
|
||||||
private InvitesManager() { }
|
private InvitesManager() { }
|
||||||
|
|
||||||
|
@ -65,11 +64,15 @@ public class InvitesManager {
|
||||||
*
|
*
|
||||||
* @return the unique instance of the store
|
* @return the unique instance of the store
|
||||||
*/
|
*/
|
||||||
public static synchronized DatabookStore initStore() {
|
public static synchronized LibClient initStore() {
|
||||||
if (store == null) {
|
if (libClient == null) {
|
||||||
store = new DBCassandraAstyanaxImpl();
|
try {
|
||||||
|
libClient = new LibClient();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return store;
|
return libClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InviteOperationResult sendInvite(
|
public InviteOperationResult sendInvite(
|
||||||
|
@ -101,22 +104,18 @@ public class InvitesManager {
|
||||||
boolean emailResult = false;
|
boolean emailResult = false;
|
||||||
try {
|
try {
|
||||||
String vreName = PortalContext.getConfiguration().getCurrentGroupName(request);
|
String vreName = PortalContext.getConfiguration().getCurrentGroupName(request);
|
||||||
result = store.saveInvite(invite);
|
result = libClient.saveInviteLib(invite);
|
||||||
if (result == InviteOperationResult.ALREADY_INVITED) {
|
if (result == InviteOperationResult.ALREADY_INVITED) {
|
||||||
//if the invite existed already the id and temp passwd has to be the same of the original invite (in the persistence)
|
//if the invite existed already the id and temp passwd has to be the same of the original invite (in the persistence)
|
||||||
String inviteid = store.isExistingInvite(currScope, email);
|
String inviteid = libClient.isExistingInviteLib(currScope, email);
|
||||||
invite.setKey(inviteid);
|
invite.setKey(inviteid);
|
||||||
String tempPwd = store.readInvite(inviteid).getControlCode();
|
String tempPwd = libClient.readInviteLib(inviteid).getControlCode();
|
||||||
invite.setControlCode(tempPwd);;
|
invite.setControlCode(tempPwd);;
|
||||||
}
|
}
|
||||||
|
|
||||||
emailResult = sendInviteEmail(request, invite, currUser, vreName, name, email, vreDescription, accountExists);
|
emailResult = sendInviteEmail(request, invite, currUser, vreName, name, email, vreDescription, accountExists);
|
||||||
notifyInviteSent(request, currUser, currScope, invite, vreName);
|
notifyInviteSent(request, currUser, currScope, invite, vreName);
|
||||||
|
|
||||||
} catch (AddressException e) {
|
|
||||||
_log.error("Email not valid " + e.getMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
return InviteOperationResult.FAILED;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
_log.error("Something wrong happened retrieving the invite which seemd to be existing already " + e.getMessage());
|
_log.error("Something wrong happened retrieving the invite which seemd to be existing already " + e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in New Issue