From d762ae0da1dff0d1a95549e73b4ff7f1d53c23a3 Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Mon, 10 Jun 2019 08:31:43 +0000 Subject: [PATCH] just added a patch code to run the catlaogue portlet by Eclipse git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@179744 82a268e6-3cf1-43bd-a215-b396298e98cf --- .classpath | 6 +++--- .settings/com.gwtplugins.gdt.eclipse.core.prefs | 2 +- .settings/org.eclipse.wst.common.component | 2 +- .../server/GcubeCkanDataCatalogServiceImpl.java | 11 +++++++++-- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.classpath b/.classpath index 18bf258..bb365f8 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,6 @@ - + @@ -20,7 +20,7 @@ - + @@ -36,5 +36,5 @@ - + diff --git a/.settings/com.gwtplugins.gdt.eclipse.core.prefs b/.settings/com.gwtplugins.gdt.eclipse.core.prefs index 0ed6330..d4acc20 100644 --- a/.settings/com.gwtplugins.gdt.eclipse.core.prefs +++ b/.settings/com.gwtplugins.gdt.eclipse.core.prefs @@ -1,4 +1,4 @@ eclipse.preferences.version=1 -lastWarOutDir=/home/francesco-mangiacrapa/eclipse-workspace/gcube-ckan-datacatalog-TRUNK/target/gcube-ckan-datacatalog-1.6.0-SNAPSHOT +lastWarOutDir=/home/francesco-mangiacrapa/eclipse-workspace/gcube-ckan-datacatalog-TRUNK/target/gcube-ckan-datacatalog-1.6.1-SNAPSHOT warSrcDir=src/main/webapp warSrcDirIsOutput=false diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index e22767e..45dec85 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,5 +1,5 @@ - + diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/GcubeCkanDataCatalogServiceImpl.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/GcubeCkanDataCatalogServiceImpl.java index 23d5e67..bc28c5c 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/GcubeCkanDataCatalogServiceImpl.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/GcubeCkanDataCatalogServiceImpl.java @@ -14,6 +14,7 @@ import javax.servlet.http.HttpSession; import org.apache.commons.codec.binary.Base64; import org.gcube.common.authorization.client.exceptions.ObjectNotFound; import org.gcube.common.authorization.library.provider.UserInfo; +import org.gcube.common.portal.PortalContext; import org.gcube.common.scope.api.ScopeProvider; import org.gcube.common.scope.impl.ScopeBean; import org.gcube.common.scope.impl.ScopeBean.Type; @@ -204,8 +205,14 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem String token = null; try{ logger.debug("Checking if token for user " + username + " in context " + context + " already exists..."); - token = authorizationService().resolveTokenByUserAndContext(username, context); - logger.debug("It exists!"); + //ADDED by Francesco Mangiacrapa + if(SessionUtil.isIntoPortal()) { + token = authorizationService().resolveTokenByUserAndContext(username, context); + logger.debug("It exists!"); + }else { + logger.debug("Out of portal, I'm reading the user token from PortalContext"); + token = PortalContext.getConfiguration().getCurrentUserToken(username,context); + } }catch(ObjectNotFound e){ logger.info("Creating token for user " + username + " and context " + context); token = authorizationService().generateUserToken(new UserInfo(username, new ArrayList()), context);