fix due to update ckan library

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@131389 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-09-15 13:50:27 +00:00
parent 521ca0bdad
commit a625555295
3 changed files with 6 additions and 16 deletions

View File

@ -64,8 +64,7 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
String queryParameter =
Window.Location.getParameter(GCubeCkanDataCatalog.GET_QUERY_PARAMETER);
String currentPortletUrl = Window.Location.getHref();
currentPortletUrl = currentPortletUrl.split("\\?")[0]; // ignore get parameters
String currentPortletUrl = Window.Location.getHref().split("\\?")[0];// ignore get parameters
GCubeCkanDataCatalog.service.getCKanConnector(
pathParameter, queryParameter, currentPortletUrl,

View File

@ -23,6 +23,7 @@ import org.gcube.common.authorization.library.provider.UserInfo;
import org.gcube.datacatalogue.ckanutillibrary.ApplicationProfileScopePerUrlReader;
import org.gcube.datacatalogue.ckanutillibrary.CKanUtils;
import org.gcube.datacatalogue.ckanutillibrary.CkanUtilsFactory;
import org.gcube.datacatalogue.ckanutillibrary.utils.UtilMethods;
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GcubeCkanDataCatalogService;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanConnectorAccessPoint;
@ -107,7 +108,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
ASLSession aslSession = getASLSession(this.getThreadLocalRequest().getSession());
// retrieve scope per current portlet url
String scopePerCurrentUrl = new ApplicationProfileScopePerUrlReader().getScopePerUrl(currentPortletUrl);
String scopePerCurrentUrl = ApplicationProfileScopePerUrlReader.getScopePerUrl(currentPortletUrl);
// save it
this.getThreadLocalRequest().getSession().setAttribute(SCOPE_CLIENT_PORTLET_URL, scopePerCurrentUrl);
@ -289,7 +290,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
String scopePerCurrentUrl = (String)this.getThreadLocalRequest().getSession().getAttribute(SCOPE_CLIENT_PORTLET_URL);
// get key per scope
String keyPerScope = UserUtil.concatenateSessionKeyScope(CKAN_HIGHEST_ROLE, scopePerCurrentUrl);
String keyPerScope = UtilMethods.concatenateSessionKeyScope(CKAN_HIGHEST_ROLE, scopePerCurrentUrl);
// check into session
if(httpSession.getAttribute(keyPerScope) != null){
@ -314,7 +315,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
// 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(UserUtil.concatenateSessionKeyScope(CKAN_ORGANIZATIONS_PUBLISH_KEY, scopePerCurrentUrl), orgsInWhichAtLeastEditorRole);
httpSession.setAttribute(keyPerScope, orgsInWhichAtLeastEditorRole);
logger.info("Set organizations in which he can publish to " + orgsInWhichAtLeastEditorRole + " into session for user " + username);
}
}catch(Exception e){
@ -446,7 +447,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
// retrieve scope per current portlet url
String scopePerCurrentUrl = (String)this.getThreadLocalRequest().getSession().getAttribute(SCOPE_CLIENT_PORTLET_URL);
String keyPerScope = UserUtil.concatenateSessionKeyScope(CKAN_ORGS_USER_KEY, scopePerCurrentUrl);
String keyPerScope = UtilMethods.concatenateSessionKeyScope(CKAN_ORGS_USER_KEY, scopePerCurrentUrl);
if(!username.equals(TEST_USER)){

View File

@ -275,14 +275,4 @@ public class UserUtil {
}
}
/**
* Builds a string made of key + scope
* @param key
* @param scope
* @return the concatenated string key|scope (e.g., "role/gcube")
*/
public static String concatenateSessionKeyScope(String key, String scope){
return key.concat(scope);
}
}