minor fix due to http session attributes moved into the ckan library
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@131395 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
e71ddc9b6c
commit
0cccb119ac
|
@ -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.SessionCatalogueAttributes;
|
||||
import org.gcube.datacatalogue.ckanutillibrary.utils.UtilMethods;
|
||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GcubeCkanDataCatalogService;
|
||||
|
@ -63,14 +64,6 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
|||
public final static String TEST_MAIL = "test.user@test-com";
|
||||
public final static String TEST_SEC_TOKEN = "4620e6d0-2313-4f48-9d54-eb3efd01a810";
|
||||
|
||||
// CKAN KEYS (PLEASE NOTE THAT THESE INFO ARE SAVED INTO SESSION PER SCOPE)
|
||||
private static final String CKAN_ORGS_USER_KEY = "ckanOrgs"; // organizations to whom he belongs (retrieved by the instance in the current scope)
|
||||
private static final String CKAN_HIGHEST_ROLE = "ckanHighestRole"; // editor, member, admin (this information is retrieved according the scope)
|
||||
private static final String CKAN_ORGANIZATIONS_PUBLISH_KEY = "ckanOrganizationsPublish"; // here he can publish (admin role)
|
||||
|
||||
// THIS IS NEEDED TO HANDLE SPECIAL CASES (e.g. for a certain portlet url we want to discover in another scope the ckan instance information)
|
||||
private final static String SCOPE_CLIENT_PORTLET_URL = "currentClientUrlPortletScope";
|
||||
|
||||
/**
|
||||
* Instanciate the ckan util library.
|
||||
* Since it needs the scope, we need to check if it is null or not
|
||||
|
@ -111,7 +104,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
|||
String scopePerCurrentUrl = ApplicationProfileScopePerUrlReader.getScopePerUrl(currentPortletUrl);
|
||||
|
||||
// save it
|
||||
this.getThreadLocalRequest().getSession().setAttribute(SCOPE_CLIENT_PORTLET_URL, scopePerCurrentUrl);
|
||||
this.getThreadLocalRequest().getSession().setAttribute(SessionCatalogueAttributes.SCOPE_CLIENT_PORTLET_URL, scopePerCurrentUrl);
|
||||
|
||||
if(queryStringParameters!=null && Base64.isBase64(queryStringParameters.getBytes())){
|
||||
byte[] valueDecoded=Base64.decodeBase64(queryStringParameters.getBytes());
|
||||
|
@ -287,11 +280,11 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
|||
}else{
|
||||
|
||||
// get the scope
|
||||
String scopePerCurrentUrl = (String)this.getThreadLocalRequest().getSession().getAttribute(SCOPE_CLIENT_PORTLET_URL);
|
||||
String scopePerCurrentUrl = (String)this.getThreadLocalRequest().getSession().getAttribute(SessionCatalogueAttributes.SCOPE_CLIENT_PORTLET_URL);
|
||||
|
||||
// get key per scope
|
||||
String keyPerScopeRole = UtilMethods.concatenateSessionKeyScope(CKAN_HIGHEST_ROLE, scopePerCurrentUrl);
|
||||
String keyPerScopeOrganizations = UtilMethods.concatenateSessionKeyScope(CKAN_ORGANIZATIONS_PUBLISH_KEY, scopePerCurrentUrl);
|
||||
String keyPerScopeRole = UtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_HIGHEST_ROLE, scopePerCurrentUrl);
|
||||
String keyPerScopeOrganizations = UtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_ORGANIZATIONS_PUBLISH_KEY, scopePerCurrentUrl);
|
||||
|
||||
// check into session
|
||||
if(httpSession.getAttribute(keyPerScopeRole) != null){
|
||||
|
@ -350,7 +343,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
|||
String username = session.getUsername();
|
||||
|
||||
// get the scope from session
|
||||
String scopePerCurrentUrl = (String)this.getThreadLocalRequest().getSession().getAttribute(SCOPE_CLIENT_PORTLET_URL);
|
||||
String scopePerCurrentUrl = (String)this.getThreadLocalRequest().getSession().getAttribute(SessionCatalogueAttributes.SCOPE_CLIENT_PORTLET_URL);
|
||||
|
||||
CkanConnectorAccessPoint ckanAP = SessionUtil.getCkanAccessPoint(this.getThreadLocalRequest().getSession(), scopePerCurrentUrl);
|
||||
logger.info("Logout from CKAN for: "+username +" by token: "+ckanAP.getGcubeTokenValue());
|
||||
|
@ -373,7 +366,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
|||
ASLSession session = getASLSession(httpSession);
|
||||
String username = session.getUsername();
|
||||
// get the scope from session
|
||||
String scopePerCurrentUrl = (String)this.getThreadLocalRequest().getSession().getAttribute(SCOPE_CLIENT_PORTLET_URL);
|
||||
String scopePerCurrentUrl = (String)this.getThreadLocalRequest().getSession().getAttribute(SessionCatalogueAttributes.SCOPE_CLIENT_PORTLET_URL);
|
||||
CkanConnectorAccessPoint ckanAP = SessionUtil.getCkanAccessPoint(this.getThreadLocalRequest().getSession(), scopePerCurrentUrl);
|
||||
// String token = getGcubeSecurityToken();
|
||||
logger.info("Logout from CKAN for: "+username +" by token: "+ckanAP.getGcubeTokenValue());
|
||||
|
@ -447,8 +440,8 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
|||
String username = session.getUsername();
|
||||
|
||||
// retrieve scope per current portlet url
|
||||
String scopePerCurrentUrl = (String)this.getThreadLocalRequest().getSession().getAttribute(SCOPE_CLIENT_PORTLET_URL);
|
||||
String keyPerScope = UtilMethods.concatenateSessionKeyScope(CKAN_ORGS_USER_KEY, scopePerCurrentUrl);
|
||||
String scopePerCurrentUrl = (String)this.getThreadLocalRequest().getSession().getAttribute(SessionCatalogueAttributes.SCOPE_CLIENT_PORTLET_URL);
|
||||
String keyPerScope = UtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_ORGS_USER_KEY, scopePerCurrentUrl);
|
||||
|
||||
if(!username.equals(TEST_USER)){
|
||||
|
||||
|
|
Loading…
Reference in New Issue