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
This commit is contained in:
Costantino Perciante 2016-07-22 09:16:50 +00:00
parent 0ea26bce58
commit a1870c7d04
2 changed files with 10 additions and 6 deletions

View File

@ -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<String, String> getCkanOrganizationsNamesAndUrlsForUser() {
// TODO generate this list dynamically taking into account the current scope
Map<String, String> toReturn = new HashMap<>();

View File

@ -61,6 +61,11 @@ public class UserUtil {
logger.info("List of VREs for "+userEMail+ " is/are: "+listOfGroups.size());
List<String> vreNames = new ArrayList<String>(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());
}