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()); }