This commit is contained in:
Francesco Mangiacrapa 2019-12-05 14:26:23 +01:00
parent 13a2028741
commit 5a4cdab8d6
16 changed files with 208 additions and 174 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/gcube-ckan-datacatalog-1.6.1-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/gcube-ckan-datacatalog-1.7.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
@ -13,6 +13,12 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
@ -20,15 +26,15 @@
</attributes>
</classpathentry>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry excluding="**" kind="src" output="target/gcube-ckan-datacatalog-1.6.1-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<classpathentry excluding="**" kind="src" output="target/gcube-ckan-datacatalog-1.7.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/gcube-ckan-datacatalog-1.6.1-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/gcube-ckan-datacatalog-1.7.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -1,4 +1,5 @@
eclipse.preferences.version=1
lastWarOutDir=/home/francesco-mangiacrapa/git/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-1.6.1-SNAPSHOT
jarsExcludedFromWebInfLib=
lastWarOutDir=/home/francesco-mangiacrapa/git/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-1.7.0-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -0,0 +1,3 @@
eclipse.preferences.version=1
entryPointModules=
gwtSyncCodeServer=true

View File

@ -1,9 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.source=1.7

View File

@ -1,9 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="gcube-ckan-datacatalog-1.6.1-SNAPSHOT">
<wb-module deploy-name="gcube-ckan-datacatalog-1.7.0-SNAPSHOT">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/resources"/>
<dependent-module archiveName="catalogue-sharing-widget-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/catalogue-sharing-widget/catalogue-sharing-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="context-root" value="gcube-ckan-datacatalog"/>
<property name="java-output-path" value="/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-1.0.0-SNAPSHOT/WEB-INF/classes"/>
</wb-module>

View File

@ -5,5 +5,5 @@
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="liferay.portlet" version="6.0"/>
<installed facet="com.gwtplugins.gwt.facet" version="1.0"/>
<installed facet="java" version="1.8"/>
<installed facet="java" version="1.7"/>
</faceted-project>

View File

@ -1,7 +1,14 @@
<ReleaseNotes>
<Changeset
component="org.gcube.portlets.gcubeckan.gcube-ckan-datacatalog.1-7-0"
date="2019-12-04">
<Change>[Bug #18212]: Guest users are able to access to whole
catalogue even if the view per organization is enabled
</Change>
</Changeset>
<Changeset
component="org.gcube.portlets.gcubeckan.gcube-ckan-datacatalog.1-6-1"
date="${buildDate}">
date="2019-04-17">
<Change>[SW Test #16580#note-6]: bug fixing
</Change>
</Changeset>

View File

@ -12,10 +12,10 @@
<outputDirectory>/</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<includes>
<include>README</include>
<include>LICENSE</include>
<include>changelog.xml</include>
<include>README.md</include>
<include>LICENSE.md</include>
<include>profile.xml</include>
<include>changelog.xml</include>
</includes>
<fileMode>755</fileMode>
<filtered>true</filtered>

43
pom.xml
View File

@ -14,14 +14,13 @@
<groupId>org.gcube.portlets.gcubeckan</groupId>
<artifactId>gcube-ckan-datacatalog</artifactId>
<packaging>war</packaging>
<version>1.6.1-SNAPSHOT</version>
<version>1.7.0-SNAPSHOT</version>
<name>gCube CKAN Data Catalog</name>
<description>The gCube CKAN Data Catalog portlet</description>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.7.0</gwtVersion>
<distroDirectory>distro</distroDirectory>
<!-- GWT needs at least java 1.6 -->
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -86,7 +85,7 @@
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId>
<scope>provided</scope>
<scope>compile</scope>
</dependency>
<!-- END FWS -->
@ -269,6 +268,44 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-project-files</id>
<phase>install</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${webappDirectory}</outputDirectory>
<resources>
<resource>
<!-- Needed to build the service archive tar.gz -->
<directory>${distroDirectory}</directory>
<filtering>true</filtering>
<includes>
<include>profile.xml</include>
</includes>
</resource>
<!-- Needed to copy the following file into .war -->
<!-- <resource> -->
<!-- <directory>${project.basedir}</directory> -->
<!-- <filtering>true</filtering> -->
<!-- <includes> -->
<!-- <include>README.md</include> -->
<!-- <include>LICENSE.md</include> -->
<!-- <include>changelog.xml</include> -->
<!-- </includes> -->
<!-- </resource> -->
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ID></ID>
<Type>Service</Type>
<Type>Portlet</Type>
<Profile>
<Description>${description}</Description>
<Class>PortletUser</Class>
@ -9,12 +9,12 @@
<Version>${version}</Version>
<Packages>
<Software>
<Name>${artifactId}</Name>
<Version>${version}</Version>
<Name>${project.artifactId}</Name>
<Description>${project.description}</Description>
<MavenCoordinates>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
</MavenCoordinates>
<Files>
<File>${project.build.finalName}.${project.packaging}</File>

View File

@ -67,12 +67,6 @@ public interface GcubeCkanDataCatalogService extends RemoteService {
// */
// String logoutURIFromCkan();
/**
* Check if the there is a user logged in.
*
* @return true, if successful
*/
boolean outsidePortal();
/**
* Check if the manage product needs to be shown (e.g., for GRSF products)
@ -84,4 +78,12 @@ public interface GcubeCkanDataCatalogService extends RemoteService {
* Check if the management panels but publish/share link must be removed
*/
String isViewPerVREEnabled();
/**
* Outside login portal.
*
* @return true, if successful
*/
boolean outsideLoginPortal();
}

View File

@ -48,13 +48,6 @@ public interface GcubeCkanDataCatalogServiceAsync {
*/
void logoutFromCkanURL(AsyncCallback<String> callback);
// /**
// * Logout uri from ckan.
// *
// * @param callback the callback
// */
// void logoutURIFromCkan(AsyncCallback<String> callback);
/**
* Gets the ckan organizations names and urls for user.
*
@ -67,27 +60,31 @@ public interface GcubeCkanDataCatalogServiceAsync {
/**
* Retrieve the list of groups to whom the user belongs and their urls.
*
* @param callback the callback
* @return the ckan groups names and urls for user
*/
void getCkanGroupsNamesAndUrlsForUser(
AsyncCallback<List<BeanUserInOrgGroupRole>> callback);
/**
* Outside portal.
* Check if the manage product needs to be shown (e.g., for GRSF products)
*
* @param callback the callback
*/
void outsidePortal(AsyncCallback<Boolean> callback);
/**
* Check if the manage product needs to be shown (e.g., for GRSF products)
* @return
*/
void isManageProductEnabled(AsyncCallback<Boolean> callback);
/**
* check if the view per vre is enabled
* @param callback
* check if the view per vre is enabled.
*
* @param callback the callback
*/
void isViewPerVREEnabled(AsyncCallback<String> callback);
/**
* Outside login portal.
*
* @param callback the callback
*/
void outsideLoginPortal(AsyncCallback<Boolean> callback);
}

View File

@ -106,7 +106,7 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
@Override
public void onSuccess(CkanConnectorAccessPoint ckan) {
if(ckan.isOutsideFromPortal()){
if(ckan.isOutsideLoginOnPortal()){
// the portlet is outside the portal and no user is logged
// in show only home and statistics
@ -121,8 +121,35 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
ckanAccessPoint = ckan;
instanceCkanFrame(ckan.buildURI());
GCubeCkanDataCatalogPanel.this.rootPanel.remove(loading);
// check if view per organisation is enabled
//and performing some actions in this case (e.g. removed the management buttons, etc.)
GCubeCkanDataCatalog.service.isViewPerVREEnabled(new AsyncCallback<String>() {
if(!ckan.isOutsideFromPortal()){
@Override
public void onSuccess(String result) {
GWT.log("isViewPerVREEnabled?: "+result);
if(result != null && !result.isEmpty()){
// hide all management buttons
managementPanel.removeGenericManagementButtons();
// set real relative path
ckanAccessPoint.addPathInfo(result);
// save this information
viewPerVREPath = result;
}
}
@Override
public void onFailure(Throwable caught) {
// ?
}
});
if(!ckan.isOutsideLoginOnPortal()){
// MANAGE CKAN MANAGEMENT PANEL ACCORDING TO MY ROLE
GCubeCkanDataCatalog.service.getMyRole(new AsyncCallback<RolesCkanGroupOrOrg>() {
@ -152,33 +179,6 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
}
});
// check if management buttons need to be removed
GCubeCkanDataCatalog.service.isViewPerVREEnabled(new AsyncCallback<String>() {
@Override
public void onSuccess(String result) {
if(result != null && !result.isEmpty()){
// hide all management buttons
managementPanel.removeGenericManagementButtons();
// set real relative path
ckanAccessPoint.addPathInfo(result);
// save this information
viewPerVREPath = result;
}
}
@Override
public void onFailure(Throwable caught) {
// ?
}
});
// retrieve organizations
GCubeCkanDataCatalog.service.getCkanOrganizationsNamesAndUrlsForUser(new AsyncCallback<List<BeanUserInOrgGroupRole>>() {

View File

@ -61,8 +61,9 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
/**
* Instanciate the ckan util library.
* Since it needs the scope, we need to check if it is null or not
*
* @param discoverScope if you want to the discover the utils library in this specified scope
* @return
* @return the catalogue
*/
public DataCatalogue getCatalogue(String discoverScope){
String currentScope = SessionUtil.getCurrentContext(getThreadLocalRequest(), false);
@ -111,7 +112,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
CkanConnectorAccessPoint ckAP = getCkanConnectorAccessPoint(pathInfoParameter, queryStringParameters, scopePerCurrentUrl);
SessionUtil.saveCkanAccessPoint(this.getThreadLocalRequest().getSession(), scopePerCurrentUrl, ckAP);
logger.info("Builded URI to CKAN Connector: "+ckAP.buildURI());
logger.info("Built the URI to CKAN (connector in case of user logged): "+ckAP.buildURI());
logger.debug("returning ckanConnectorUri: "+ckAP);
return ckAP;
}catch(Exception e ){
@ -127,14 +128,15 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
*
* @param pathInfoParameter the path info parameter
* @param queryStringParameters the query string parameters
* @param scopePerCurrentUrl the scope per current url
* @return the ckan connector access point
* @throws Exception
* @throws Exception the exception
*/
private CkanConnectorAccessPoint getCkanConnectorAccessPoint(String pathInfoParameter, String queryStringParameters, String scopePerCurrentUrl) throws Exception {
if(outsidePortal()){
if(outsideLoginPortal()){
CkanConnectorAccessPoint ckan = new CkanConnectorAccessPoint(getCatalogue(scopePerCurrentUrl).getCatalogueUrl(),"");
ckan.setOutsideFromPortal(true);
ckan.setOutsideLoginOnPortal(true);
ckan.addPathInfo(pathInfoParameter);
ckan.addQueryString(queryStringParameters);
return ckan;
@ -193,10 +195,11 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
}
/**
* Gets the gcube security token for the user in current session and for a given scope
* Gets the gcube security token for the user in current session and for a given scope.
*
* @param context the context
* @return the gcube security token
* @throws Exception
* @throws Exception the exception
*/
protected String getGcubeSecurityToken(String context) throws Exception {
@ -287,9 +290,11 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
}
/**
* Fetch the list of ckan groups for which the user is member
* @param context
* @return
* Fetch the list of ckan groups for which the user is member.
*
* @param context the context
* @param username the username
* @return the list
*/
private List<OrganizationBean> fetchUserGroups(String context, String username) {
@ -344,7 +349,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
public String logoutFromCkanURL() {
// check if the portlet is accessed from outside the portal
if(outsidePortal())
if(outsideLoginPortal())
return null;
HttpSession httpSession = this.getThreadLocalRequest().getSession();
@ -372,68 +377,11 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
String deleteURI = ckan.buildURI();
logger.debug(GcubeCkanDataCatalogServiceImpl.CKANCONNECTORLOGOUT + " returning: "+deleteURI);
return deleteURI;
/*HttpSession httpSession = this.getThreadLocalRequest().getSession();
ASLSession session = getASLSession(httpSession);
String username = session.getUsername();
// get the scope from session
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());
String ckanConnectorLogut = getServletContext().getInitParameter(CKANCONNECTORLOGOUT);
logger.debug(CKANCONNECTORLOGOUT + " is: "+ckanConnectorLogut);
CkanConnectorAccessPoint ckan = new CkanConnectorAccessPoint(ckanAP.getBaseUrl(), ckanConnectorLogut);
ckan.addPathInfo(ckanConnectorLogut);
ckan.addGubeToken(ckanAP.getGcubeTokenValue());
URL url;
try {
String deleteURI = ckan.buildURI();
logger.debug("Perfoming HTTP delete to URI: "+deleteURI);
url = new URL(deleteURI);
HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();
httpCon.setDoOutput(true);
httpCon.setRequestProperty("Content-Type", "application/x-www-form-urlencoded" );
httpCon.setRequestMethod("DELETE");
httpCon.connect();
HttpServletResponse response = this.getThreadLocalResponse();
if(httpCon.getResponseCode()==HttpStatus.SC_OK){
response.setContentLength(httpCon.getContentLength());
Map<String, List<String>> map = httpCon.getHeaderFields();
for (String key : map.keySet()) {
String hf = httpCon.getHeaderField(key);
logger.trace("key: "+key +", value: "+hf);
if(key==null){
logger.trace("skyp key: "+key +", value: "+hf);
}else
response.setHeader(key,hf);
}
response.setContentLength(httpCon.getContentLength());
String encoding = httpCon.getContentEncoding();
encoding = encoding == null ? UTF_8 : encoding;
response.setCharacterEncoding(encoding);
response.setStatus(HttpStatus.SC_OK);
InputStream in = httpCon.getInputStream();
ServletOutputStream out = response.getOutputStream();
IOUtils.copy(in, out);
logger.info("Logout Completed, response code: "+HttpStatus.SC_OK);
}else{
logger.warn("An error occurred during perfoming CKAN logout, Response status is: "+httpCon.getResponseCode());
}
}
catch (IOException e) {
logger.error("An error occured during performing Logout from CKAN for: "+username +" by token: "+ckanAP.getGcubeTokenValue(), e);
}*/
}
/* (non-Javadoc)
* @see org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GcubeCkanDataCatalogService#getCkanOrganizationsNamesAndUrlsForUser()
*/
@Override
public List<BeanUserInOrgGroupRole> getCkanOrganizationsNamesAndUrlsForUser() {
@ -479,6 +427,9 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
}
/* (non-Javadoc)
* @see org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GcubeCkanDataCatalogService#getCkanGroupsNamesAndUrlsForUser()
*/
@Override
public List<BeanUserInOrgGroupRole> getCkanGroupsNamesAndUrlsForUser() {
List<BeanUserInOrgGroupRole> toReturn = new ArrayList<BeanUserInOrgGroupRole>();
@ -526,8 +477,14 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
}
/*
* Returns true either you are outside gateway (in eclipse mode)
* or you are on the gateway and the user is not logged (i.e. public VRE catalogue)
*
*/
@Override
public boolean outsidePortal() {
public boolean outsideLoginPortal() {
if(!SessionUtil.isIntoPortal()){
@ -546,6 +503,9 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
}
}
/* (non-Javadoc)
* @see org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GcubeCkanDataCatalogService#isManageProductEnabled()
*/
@Override
public boolean isManageProductEnabled() {
logger.info("Checking if the manage product button needs to be shown or not for the current context");
@ -568,17 +528,26 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
}
/**
* Ask to liferay
* @return
* Ask to liferay.
*
* @return the string
*/
@Override
public String isViewPerVREEnabled(){
String toReturn = null;
String scopePerCurrentUrl = ScopeProvider.instance.get();// the view per vre can be managed independently for each context SessionUtil.getScopeFromClientUrl(getThreadLocalRequest());
logger.debug("Read contest for isViewPerVREEnabled() " + scopePerCurrentUrl);
String scopePerCurrentUrl = SessionUtil.getScopeFromClientUrl(getThreadLocalRequest());// the view per vre can be managed independently for each context SessionUtil.getScopeFromClientUrl(getThreadLocalRequest());
//String scopePerCurrentUrl = PortalContext.getConfiguration().getCurrentScope(getThreadLocalRequest());
logger.debug("isViewPerVREEnabled called, read context: " + scopePerCurrentUrl);
boolean enabled = false;
try{
if(!SessionUtil.isIntoPortal()){
enabled = true;
logger.warn("Enabling View per VRE in DEV mode");
return "/organization_vre/" + scopePerCurrentUrl.substring(scopePerCurrentUrl.lastIndexOf("/")+1,scopePerCurrentUrl.length()).toLowerCase(); //is the VRE name
}
GroupManager gm = new LiferayGroupManager();
enabled = (boolean) gm.readCustomAttr(gm.getGroupIdFromInfrastructureScope(scopePerCurrentUrl), VIEW_PER_ORGANIZATION_LIFERAY_CUSTOM_FIELD);
if(enabled){

View File

@ -33,8 +33,8 @@ public class CkanConnectorAccessPoint implements Serializable{
private String queryStringParameters;
private String gcubeTokenValue;
private Map<String, String> mapVresRoles;
private String serverviceContext;
private boolean outsideFromPortal = false;
private String serviceContext;
private boolean outsideLoginOnPortal = false;
private String catalogueBaseUrl = null;
/**
@ -43,17 +43,16 @@ public class CkanConnectorAccessPoint implements Serializable{
public CkanConnectorAccessPoint() {
}
/**
* Instantiates a new ckan connector access point.
*
* @param baseUrl the base url
* @param serverContext the server context
* @param serviceContext the service context
*/
public CkanConnectorAccessPoint(String baseUrl, String servericeContext){
public CkanConnectorAccessPoint(String baseUrl, String serviceContext){
this.baseUrl = baseUrl;
this.catalogueBaseUrl = baseUrl.split("ckan-connector")[0];
this.serverviceContext = servericeContext;
this.serviceContext = serviceContext;
}
/**
@ -90,7 +89,7 @@ public class CkanConnectorAccessPoint implements Serializable{
* @param value the value
*/
public void addGubeToken(String value){
if(!outsideFromPortal){
if(!outsideLoginOnPortal){
this.gcubeTokenValue = value;
addGenericParameter(GCUBE_TOKEN_PARAMETER, value);
}
@ -128,7 +127,7 @@ public class CkanConnectorAccessPoint implements Serializable{
/**
* Builds the uri to contact the CKAN Connector.
* Builds the URI to contact the CKAN (connector in case of user logged)
*
* @return the string
*/
@ -138,7 +137,9 @@ public class CkanConnectorAccessPoint implements Serializable{
String query = "";
path = checkURLPathSeparator(pathInfoParameter, true, false);
query = checkNullString(queryStringParameters);
return getBaseUrlWithContext()+path+"?"+query;
String url = getBaseUrlWithContext()+path;
url+= !query.isEmpty()?"?"+query:"";
return url;
}
/**
@ -148,7 +149,7 @@ public class CkanConnectorAccessPoint implements Serializable{
*/
public String getBaseUrlWithContext() {
return baseUrl+serverviceContext;
return baseUrl+serviceContext;
}
@ -243,28 +244,31 @@ public class CkanConnectorAccessPoint implements Serializable{
}
/**
* @return the outsideFromPortal
* Checks if is outside login on portal.
*
* @return true, if is outside login on portal
*/
public boolean isOutsideFromPortal() {
public boolean isOutsideLoginOnPortal() {
return outsideFromPortal;
return outsideLoginOnPortal;
}
/**
* @param outsideFromPortal the outsideFromPortal to set
* Sets the outside login on portal.
*
* @param noUserLogin the new outside login on portal
*/
public void setOutsideFromPortal(boolean outsideFromPortal) {
public void setOutsideLoginOnPortal(boolean noUserLogin) {
this.outsideFromPortal = outsideFromPortal;
this.outsideLoginOnPortal = noUserLogin;
}
/**
*
* Gets the catalogue base url.
*
* @return the catalogue url
*/
public String getCatalogueBaseUrl() {
@ -272,6 +276,9 @@ public class CkanConnectorAccessPoint implements Serializable{
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
@ -285,10 +292,10 @@ public class CkanConnectorAccessPoint implements Serializable{
builder.append(gcubeTokenValue);
builder.append(", mapVresRoles=");
builder.append(mapVresRoles);
builder.append(", serverviceContext=");
builder.append(serverviceContext);
builder.append(", serviceContext=");
builder.append(serviceContext);
builder.append(", outsideFromPortal=");
builder.append(outsideFromPortal);
builder.append(outsideLoginOnPortal);
builder.append(", catalogueBaseUrl=");
builder.append(catalogueBaseUrl);
builder.append("]");

1
src/test/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/resources/