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 0cb1056..edc5b1c 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 @@ -56,7 +56,10 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem public final static String TEST_USER = "test.user"; public final static String TEST_SCOPE = "/gcube/devsec/devVRE"; - public final static String PRODUCTION_SCOPE = "/d4science.research-infrastructures.eu"; + // TO BE REMOVED TODO + public final static String PRODUCTION_SCOPE_ROOT = "/d4science.research-infrastructures.eu"; + public final static String PRODUCTION_CKAN_ORGNAME_ROOT = "d4science"; + public final static String PRODUCTION_LIFERAY_ORGNAME_ROOT = "d4science"; public final static String TEST_MAIL = "test.user@test-com"; public final static String TEST_SEC_TOKEN = "4620e6d0-2313-4f48-9d54-eb3efd01a810"; @@ -83,8 +86,8 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem if(user.equals(TEST_USER)){ // session expired or, maybe, outside the portal logger.warn("User is "+TEST_USER +" are we out from portal?"); - logger.warn("I'm using root scope "+PRODUCTION_SCOPE); - instance = new CKanUtilsImpl(PRODUCTION_SCOPE); + logger.warn("I'm using root scope "+PRODUCTION_SCOPE_ROOT); + instance = new CKanUtilsImpl(PRODUCTION_SCOPE_ROOT); }else{ if(discoverScope != null && !discoverScope.isEmpty()) instance = new CKanUtilsImpl(discoverScope); 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 a05874a..f9fc0de 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 @@ -206,11 +206,11 @@ public class UserUtil { if(ckanUtils != null){ boolean res = ckanUtils.checkRole(username, gCubeGroupName, correspondentRoleToCheck); if(res){ - // get the orgs of the user List ckanOrgs = ckanUtils.getOrganizationsByUser(username); for (CkanOrganization ckanOrganization : ckanOrgs) { - if(ckanOrganization.getName().equals(gCubeGroupName.toLowerCase())){ + if(gCubeGroupName.equals(GcubeCkanDataCatalogServiceImpl.PRODUCTION_LIFERAY_ORGNAME_ROOT) || + ckanOrganization.getName().equals(gCubeGroupName.toLowerCase())){ orgsInWhichAdminRole.add(new OrganizationBean(ckanOrganization.getTitle(), ckanOrganization.getName())); break; }