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 d4955a2..1c98804 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 @@ -290,12 +290,13 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem String scopePerCurrentUrl = (String)this.getThreadLocalRequest().getSession().getAttribute(SCOPE_CLIENT_PORTLET_URL); // get key per scope - String keyPerScope = UtilMethods.concatenateSessionKeyScope(CKAN_HIGHEST_ROLE, scopePerCurrentUrl); - + String keyPerScopeRole = UtilMethods.concatenateSessionKeyScope(CKAN_HIGHEST_ROLE, scopePerCurrentUrl); + String keyPerScopeOrganizations = UtilMethods.concatenateSessionKeyScope(CKAN_ORGANIZATIONS_PUBLISH_KEY, scopePerCurrentUrl); + // check into session - if(httpSession.getAttribute(keyPerScope) != null){ + if(httpSession.getAttribute(keyPerScopeRole) != null){ - toReturn = (CkanRole)httpSession.getAttribute(keyPerScope); + toReturn = (CkanRole)httpSession.getAttribute(keyPerScopeRole); logger.info("Found user role into session " + toReturn + " and it is going to be returned for user " + username); }else{ @@ -309,13 +310,13 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem toReturn = UserUtil.getHighestRole(scopePerCurrentUrl, username, groupName, this, orgsInWhichAtLeastEditorRole); // put role in session - httpSession.setAttribute(keyPerScope, toReturn); + httpSession.setAttribute(keyPerScopeRole, toReturn); logger.info("Set role " + toReturn + " into session for user " + username); // 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(keyPerScope, orgsInWhichAtLeastEditorRole); + httpSession.setAttribute(keyPerScopeOrganizations, orgsInWhichAtLeastEditorRole); logger.info("Set organizations in which he can publish to " + orgsInWhichAtLeastEditorRole + " into session for user " + username); } }catch(Exception e){