From 5a4cdab8d6bc43c2f99f3699a7f3e7256e13b70b Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Thu, 5 Dec 2019 14:26:23 +0100 Subject: [PATCH] Fixing Bug #18212 --- .classpath | 14 +- .../com.gwtplugins.gdt.eclipse.core.prefs | 3 +- .../com.gwtplugins.gwt.eclipse.core.prefs | 3 + .settings/org.eclipse.jdt.core.prefs | 6 +- .settings/org.eclipse.wst.common.component | 6 +- ....eclipse.wst.common.project.facet.core.xml | 2 +- changelog.xml | 9 +- descriptor.xml | 6 +- pom.xml | 43 ++++++- profile.xml | 12 +- .../client/GcubeCkanDataCatalogService.java | 14 +- .../GcubeCkanDataCatalogServiceAsync.java | 29 ++--- .../view/GCubeCkanDataCatalogPanel.java | 58 ++++----- .../GcubeCkanDataCatalogServiceImpl.java | 121 +++++++----------- .../shared/CkanConnectorAccessPoint.java | 55 ++++---- src/test/.gitignore | 1 + 16 files changed, 208 insertions(+), 174 deletions(-) create mode 100644 .settings/com.gwtplugins.gwt.eclipse.core.prefs create mode 100644 src/test/.gitignore diff --git a/.classpath b/.classpath index 1cf3fec..a190e04 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,6 @@ - + @@ -13,6 +13,12 @@ + + + + + + @@ -20,15 +26,15 @@ - + - + - + diff --git a/.settings/com.gwtplugins.gdt.eclipse.core.prefs b/.settings/com.gwtplugins.gdt.eclipse.core.prefs index 604041d..99f741f 100644 --- a/.settings/com.gwtplugins.gdt.eclipse.core.prefs +++ b/.settings/com.gwtplugins.gdt.eclipse.core.prefs @@ -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 diff --git a/.settings/com.gwtplugins.gwt.eclipse.core.prefs b/.settings/com.gwtplugins.gwt.eclipse.core.prefs new file mode 100644 index 0000000..c516ac9 --- /dev/null +++ b/.settings/com.gwtplugins.gwt.eclipse.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +entryPointModules= +gwtSyncCodeServer=true diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 4e4a3ad..8db228c 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -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 diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 45dec85..a503e00 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,9 +1,13 @@ - + + + + uses + diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml index 267a6f3..f049f34 100644 --- a/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -5,5 +5,5 @@ - + diff --git a/changelog.xml b/changelog.xml index 98afb1e..6d1c10e 100644 --- a/changelog.xml +++ b/changelog.xml @@ -1,7 +1,14 @@ + + [Bug #18212]: Guest users are able to access to whole + catalogue even if the view per organization is enabled + + + date="2019-04-17"> [SW Test #16580#note-6]: bug fixing diff --git a/descriptor.xml b/descriptor.xml index 9a62ba9..180c338 100644 --- a/descriptor.xml +++ b/descriptor.xml @@ -12,10 +12,10 @@ / true - README - LICENSE - changelog.xml + README.md + LICENSE.md profile.xml + changelog.xml 755 true diff --git a/pom.xml b/pom.xml index fd948bf..339f0e7 100644 --- a/pom.xml +++ b/pom.xml @@ -14,14 +14,13 @@ org.gcube.portlets.gcubeckan gcube-ckan-datacatalog war - 1.6.1-SNAPSHOT + 1.7.0-SNAPSHOT gCube CKAN Data Catalog The gCube CKAN Data Catalog portlet 2.7.0 - distro ${project.build.directory}/${project.build.finalName} UTF-8 @@ -86,7 +85,7 @@ org.gcube.core common-scope-maps - provided + compile @@ -269,6 +268,44 @@ + + + org.apache.maven.plugins + maven-resources-plugin + 2.5 + + + copy-project-files + install + + copy-resources + + + ${webappDirectory} + + + + ${distroDirectory} + true + + profile.xml + + + + + + + + + + + + + + + + + diff --git a/profile.xml b/profile.xml index e90aaa2..16b7c09 100644 --- a/profile.xml +++ b/profile.xml @@ -1,7 +1,7 @@ - Service + Portlet ${description} PortletUser @@ -9,12 +9,12 @@ ${version} - ${artifactId} - ${version} + ${project.artifactId} + ${project.description} - ${groupId} - ${artifactId} - ${version} + ${project.groupId} + ${project.artifactId} + ${project.version} ${project.build.finalName}.${project.packaging} diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogService.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogService.java index 61e8c04..1b4a5fb 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogService.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogService.java @@ -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(); } diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogServiceAsync.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogServiceAsync.java index 3b58ff8..eeedcb7 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogServiceAsync.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/GcubeCkanDataCatalogServiceAsync.java @@ -48,13 +48,6 @@ public interface GcubeCkanDataCatalogServiceAsync { */ void logoutFromCkanURL(AsyncCallback callback); - // /** - // * Logout uri from ckan. - // * - // * @param callback the callback - // */ - // void logoutURIFromCkan(AsyncCallback 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> callback); /** - * Outside portal. + * Check if the manage product needs to be shown (e.g., for GRSF products) * * @param callback the callback */ - void outsidePortal(AsyncCallback callback); - - /** - * Check if the manage product needs to be shown (e.g., for GRSF products) - * @return - */ void isManageProductEnabled(AsyncCallback 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 callback); + + + /** + * Outside login portal. + * + * @param callback the callback + */ + void outsideLoginPortal(AsyncCallback callback); } diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java index fae4283..8f8ea39 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java @@ -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() { - 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() { @@ -152,33 +179,6 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate { } }); - // check if management buttons need to be removed - GCubeCkanDataCatalog.service.isViewPerVREEnabled(new AsyncCallback() { - - @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>() { 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 e0a95a6..62aa0be 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 @@ -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 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> 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 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 getCkanGroupsNamesAndUrlsForUser() { List toReturn = new ArrayList(); @@ -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){ diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/shared/CkanConnectorAccessPoint.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/shared/CkanConnectorAccessPoint.java index 681f478..4049977 100644 --- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/shared/CkanConnectorAccessPoint.java +++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/shared/CkanConnectorAccessPoint.java @@ -33,8 +33,8 @@ public class CkanConnectorAccessPoint implements Serializable{ private String queryStringParameters; private String gcubeTokenValue; private Map 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("]"); diff --git a/src/test/.gitignore b/src/test/.gitignore new file mode 100644 index 0000000..cb6eb2c --- /dev/null +++ b/src/test/.gitignore @@ -0,0 +1 @@ +/resources/