Compare commits

..

1 Commits

Author SHA1 Message Date
Ahmed Salah Tawfik Ibrahim b4e312482c Compatible with social model 2.0.0 2024-01-30 18:23:46 +01:00
6 changed files with 43 additions and 98 deletions

View File

@ -1,28 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="accept-invite-portlet">
<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"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="invites-common-library-1.5.1.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/invites-common-library/invites-common-library">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="email-templates-library-1.5.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/email-templates-library/email-templates-library">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="context-root" value="accept-invite-portlet"/>
<property name="java-output-path" value="/accept-invite-portlet/target/classes"/>
</wb-module>
</project-modules>

View File

@ -1,7 +0,0 @@
<root>
<facet id="jst.jaxrs">
<node name="libprov">
<attribute name="provider-id" value="jaxrs-no-op-library-provider"/>
</node>
</facet>
</root>

View File

@ -5,5 +5,4 @@
<installed facet="liferay.portlet" version="6.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="java" version="1.8"/>
<installed facet="jst.jaxrs" version="2.0"/>
</faceted-project>

View File

@ -4,12 +4,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v2.1.0] - 2024-04-22
- Fix for Incident #27306
## [v2.0.1] - 2022-06-16
- Release for HL portal removal
- Removed Social Networking Library dependency #26523
## [v2.0.0] - 2020-07-21

31
pom.xml
View File

@ -6,13 +6,13 @@
<parent>
<groupId>org.gcube.tools</groupId>
<artifactId>maven-parent</artifactId>
<version>1.2.0</version>
<version>1.1.0</version>
</parent>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>accept-invite-portlet</artifactId>
<packaging>war</packaging>
<name>accept-invite-portlet Portlet</name>
<version>2.1.0</version>
<version>2.0.1</version>
<description>
accept-invite-portlet manage the sent invitations
</description>
@ -28,14 +28,13 @@
<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>
<liferay.app.server.portal.dir>/Users/massi/portal/liferay-portal-6.2-ce-ga6/tomcat-7.0.62/webapps/ROOT</liferay.app.server.portal.dir>
<java-version>1.8</java-version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>3.7.0</version>
<version>3.6.4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -57,29 +56,16 @@
<artifactId>json-simple</artifactId>
<scope>provided</scope>
</dependency>
<!-- should be provided -->
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>social-library-stubs</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0)</version>
<scope>provided</scope>
<groupId>org.gcube.social-networking</groupId>
<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>
<exclusions>
<exclusion>
<groupId>org.gcube.portal</groupId>
<artifactId>social-networking-library</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.dvos</groupId>
@ -194,6 +180,9 @@
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>build-css</goal>
</goals>
</execution>
</executions>
<configuration>

View File

@ -13,10 +13,6 @@
*/
package org.gcube.portlets.user.acceptinvite;
import static org.gcube.common.authorization.client.Constants.authorizationService;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -28,16 +24,12 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.commons.codec.binary.Base64;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.authorization.library.provider.UserInfo;
import org.gcube.common.portal.PortalContext;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.portal.databook.server.DBCassandraAstyanaxImpl;
import org.gcube.portal.databook.server.DatabookStore;
import org.gcube.portal.databook.shared.Invite;
import org.gcube.portal.databook.shared.InviteStatus;
import org.gcube.portal.databook.shared.ex.InviteIDNotFoundException;
import org.gcube.portal.databook.shared.ex.InviteStatusNotFoundException;
import org.gcube.social_networking.social_networking_client_library.LibClient;
import org.gcube.social_networking.socialnetworking.model.shared.Invite;
import org.gcube.social_networking.socialnetworking.model.shared.InviteStatus;
import org.gcube.social_networking.socialnetworking.model.shared.exceptions.InviteIDNotFoundException;
import org.gcube.social_networking.socialnetworking.model.shared.exceptions.InviteStatusNotFoundException;
import org.gcube.portal.invites.InvitesManager;
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault;
@ -81,20 +73,21 @@ public class PortletViewController {
private static String MODEL_ATTR = "theModel";
private static DatabookStore store;
private final static String DEFAULT_ROLE = "OrganizationMember";
private static LibClient libClient;
/**
*
* @return the unique instance of the store
*/
public static synchronized DatabookStore getStore() {
if (store == null) {
PortalContext pContext = PortalContext.getConfiguration();
String context = "/" + pContext.getInfrastructureName();
ScopeProvider.instance.set(context);
store = new DBCassandraAstyanaxImpl();
public static synchronized LibClient getClient() {
if (libClient == null) {
try {
libClient = new LibClient();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return store;
return libClient;
}
@RenderMapping
@ -124,16 +117,7 @@ public class PortletViewController {
Invite invite = null;
try {
String token = generateAuthorizationToken();
SecurityTokenProvider.instance.set(token);
invite = getStore().readInvite(inviteId);
} catch (InviteIDNotFoundException | InviteStatusNotFoundException e) {
e.printStackTrace();
return PAGE_INVITE_NOTFOUND;
}
invite = getClient().readInviteLib(inviteId);
if (invite.getStatus() == InviteStatus.ACCEPTED)
return PAGE_INVITE_EXPIRED;
@ -160,22 +144,7 @@ public class PortletViewController {
return PAGE_INVITE_PROCESS;
}
private static String generateAuthorizationToken() {
PortalContext pContext = PortalContext.getConfiguration();
String context = "/" + pContext.getInfrastructureName();
ScopeProvider.instance.set(context);
String username = "roberto.cirillo";
List<String> userRoles = new ArrayList<>();
userRoles.add(DEFAULT_ROLE);
String token;
try {
token = authorizationService().generateUserToken(new UserInfo(username, userRoles), context);
} catch (Exception e) {
e.printStackTrace();
return null;
}
return token;
}
@ResourceMapping(value="createAccount")