From a1870c7d04a540d30e091d699bd1fb605d0b8652 Mon Sep 17 00:00:00 2001 From: Costantino Perciante Date: Fri, 22 Jul 2016 09:16:50 +0000 Subject: [PATCH] the ckan connector needs the production root vo name organization as it is on ckan-d4s.d4science.org git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@130686 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../server/GcubeCkanDataCatalogServiceImpl.java | 11 +++++------ .../gcubeckandatacatalog/server/UserUtil.java | 5 +++++ 2 files changed, 10 insertions(+), 6 deletions(-) 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 9ed748c..09187ac 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 @@ -85,10 +85,9 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem logger.warn("I'm using root scope "+ CKanUtilsImpl.PRODUCTION_SCOPE_ROOT); instance = new CKanUtilsImpl(CKanUtilsImpl.PRODUCTION_SCOPE_ROOT); }else{ - if(discoverScope != null && !discoverScope.isEmpty()) - instance = new CKanUtilsImpl(discoverScope); - else - instance = new CKanUtilsImpl(currentScope); + String scopeInWhichDiscover = (discoverScope != null && !discoverScope.isEmpty()) ? discoverScope : currentScope; + logger.debug("Discovering ckan utils library into scope " + scopeInWhichDiscover); + instance = new CKanUtilsImpl(scopeInWhichDiscover); } }catch(Exception e){ logger.error("Unable to retrieve ckan utils", e); @@ -299,7 +298,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem httpSession.setAttribute(keyPerScope, toReturn); logger.info("Set role " + toReturn + " into session for user " + username); - + // if he is an admin preload: // 1) organizations in which he can publish (the widget will find these info in session) if(toReturn.equals(CkanRole.ADMIN)){ @@ -411,7 +410,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem @Override public Map getCkanOrganizationsNamesAndUrlsForUser() { - + // TODO generate this list dynamically taking into account the current scope Map toReturn = new HashMap<>(); 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 ca40675..368438c 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 @@ -61,6 +61,11 @@ public class UserUtil { logger.info("List of VREs for "+userEMail+ " is/are: "+listOfGroups.size()); List vreNames = new ArrayList(listOfGroups.size()); for (GCubeGroup gCubeGroup : listOfGroups) { + + // TODO: why only the VRES??...however check for the production root vo + if(gCubeGroup.getGroupName().equals(CKanUtilsImpl.PRODUCTION_LIFERAY_ORGNAME_ROOT)) + vreNames.add(CKanUtilsImpl.PRODUCTION_CKAN_ORGNAME_ROOT); + if(groupManager.isVRE(gCubeGroup.getGroupId())) //Is it a VRE? vreNames.add(gCubeGroup.getGroupName()); }