From a6255552956a36e1a33a91f43a5577ff44440222 Mon Sep 17 00:00:00 2001 From: Costantino Perciante Date: Thu, 15 Sep 2016 13:50:27 +0000 Subject: [PATCH] fix due to update ckan library git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@131389 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/view/GCubeCkanDataCatalogPanel.java | 3 +-- .../server/GcubeCkanDataCatalogServiceImpl.java | 9 +++++---- .../gcubeckandatacatalog/server/UserUtil.java | 10 ---------- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java index fa41111..e76970a 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java @@ -64,8 +64,7 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate { String queryParameter = Window.Location.getParameter(GCubeCkanDataCatalog.GET_QUERY_PARAMETER); - String currentPortletUrl = Window.Location.getHref(); - currentPortletUrl = currentPortletUrl.split("\\?")[0]; // ignore get parameters + String currentPortletUrl = Window.Location.getHref().split("\\?")[0];// ignore get parameters GCubeCkanDataCatalog.service.getCKanConnector( pathParameter, queryParameter, currentPortletUrl, 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 4cde739..d4955a2 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 @@ -23,6 +23,7 @@ import org.gcube.common.authorization.library.provider.UserInfo; import org.gcube.datacatalogue.ckanutillibrary.ApplicationProfileScopePerUrlReader; import org.gcube.datacatalogue.ckanutillibrary.CKanUtils; import org.gcube.datacatalogue.ckanutillibrary.CkanUtilsFactory; +import org.gcube.datacatalogue.ckanutillibrary.utils.UtilMethods; import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GcubeCkanDataCatalogService; import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanConnectorAccessPoint; @@ -107,7 +108,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem ASLSession aslSession = getASLSession(this.getThreadLocalRequest().getSession()); // retrieve scope per current portlet url - String scopePerCurrentUrl = new ApplicationProfileScopePerUrlReader().getScopePerUrl(currentPortletUrl); + String scopePerCurrentUrl = ApplicationProfileScopePerUrlReader.getScopePerUrl(currentPortletUrl); // save it this.getThreadLocalRequest().getSession().setAttribute(SCOPE_CLIENT_PORTLET_URL, scopePerCurrentUrl); @@ -289,7 +290,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem String scopePerCurrentUrl = (String)this.getThreadLocalRequest().getSession().getAttribute(SCOPE_CLIENT_PORTLET_URL); // get key per scope - String keyPerScope = UserUtil.concatenateSessionKeyScope(CKAN_HIGHEST_ROLE, scopePerCurrentUrl); + String keyPerScope = UtilMethods.concatenateSessionKeyScope(CKAN_HIGHEST_ROLE, scopePerCurrentUrl); // check into session if(httpSession.getAttribute(keyPerScope) != null){ @@ -314,7 +315,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem // if he is an admin/editor preload: // 1) organizations in which he can publish (the widget will find these info in session) if(toReturn.equals(CkanRole.ADMIN) || toReturn.equals(CkanRole.EDITOR)){ - httpSession.setAttribute(UserUtil.concatenateSessionKeyScope(CKAN_ORGANIZATIONS_PUBLISH_KEY, scopePerCurrentUrl), orgsInWhichAtLeastEditorRole); + httpSession.setAttribute(keyPerScope, orgsInWhichAtLeastEditorRole); logger.info("Set organizations in which he can publish to " + orgsInWhichAtLeastEditorRole + " into session for user " + username); } }catch(Exception e){ @@ -446,7 +447,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem // retrieve scope per current portlet url String scopePerCurrentUrl = (String)this.getThreadLocalRequest().getSession().getAttribute(SCOPE_CLIENT_PORTLET_URL); - String keyPerScope = UserUtil.concatenateSessionKeyScope(CKAN_ORGS_USER_KEY, scopePerCurrentUrl); + String keyPerScope = UtilMethods.concatenateSessionKeyScope(CKAN_ORGS_USER_KEY, scopePerCurrentUrl); if(!username.equals(TEST_USER)){ diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/UserUtil.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/UserUtil.java index 7e6e2d2..7629914 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/UserUtil.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/server/UserUtil.java @@ -275,14 +275,4 @@ public class UserUtil { } } - - /** - * Builds a string made of key + scope - * @param key - * @param scope - * @return the concatenated string key|scope (e.g., "role/gcube") - */ - public static String concatenateSessionKeyScope(String key, String scope){ - return key.concat(scope); - } }