From 42bf3732510036783b29b7c9cd53562be0125e90 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Tue, 26 Jul 2022 16:28:25 +0200 Subject: [PATCH] #23689 Fixed the search facility is buggy when used from public access --- .classpath | 16 +-- .../com.gwtplugins.gdt.eclipse.core.prefs | 2 +- .settings/org.eclipse.jdt.core.prefs | 2 +- .settings/org.eclipse.wst.common.component | 112 ++++++++++++++++-- ....eclipse.wst.common.project.facet.core.xml | 2 +- CHANGELOG.md | 6 + pom.xml | 41 ++++--- .../GeoportalDataViewerServiceImpl.java | 5 +- .../ConcessioniMongoServiceIdentityProxy.java | 3 + 9 files changed, 147 insertions(+), 42 deletions(-) diff --git a/.classpath b/.classpath index 2804d0c..c1c10e2 100644 --- a/.classpath +++ b/.classpath @@ -1,12 +1,12 @@ - + - + @@ -24,16 +24,16 @@ - - - - - - + + + + + + diff --git a/.settings/com.gwtplugins.gdt.eclipse.core.prefs b/.settings/com.gwtplugins.gdt.eclipse.core.prefs index 0978564..c19da06 100644 --- a/.settings/com.gwtplugins.gdt.eclipse.core.prefs +++ b/.settings/com.gwtplugins.gdt.eclipse.core.prefs @@ -1,4 +1,4 @@ eclipse.preferences.version=1 -lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-2.2.0 +lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-2.3.0-SNAPSHOT warSrcDir=src/main/webapp warSrcDirIsOutput=false diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index cac0df4..ca4c66e 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -6,6 +6,6 @@ org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.release=disabled org.eclipse.jdt.core.compiler.source=1.8 diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index dc1ce23..98cda2a 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,59 +1,149 @@ - + - - + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + - + + + + + + + + + + - + + + + + + + + + + - + + + + + + + + + + - + + + + + + + + + + - + + + + + + + + + + - + + + + + + + + + + - + + + + + + + + + + diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml index f8273be..cd892cb 100644 --- a/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -1,7 +1,7 @@ - + diff --git a/CHANGELOG.md b/CHANGELOG.md index 664a16a..347457c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v2.3.0-SNAPSHOT] - 2022-07-26 + +#### Bug fixed + +- [#23689] Fixed the search facility is buggy when used from public access +- Moved to 3.7.0-SNAPSHOT ## [v2.2.0] - 2021-12-07 diff --git a/pom.xml b/pom.xml index a41e451..41e3f84 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ org.gcube.portlets.user geoportal-data-viewer-app war - 2.2.0 + 2.3.0-SNAPSHOT GeoPortal Data Viewer App The GeoPortal Data Viewer App is an application to access, discovery and navigate the GeoNa products by a Web-Map Interface @@ -54,23 +54,9 @@ org.gcube.distribution maven-portal-bom - 3.6.3 + 3.7.0-SNAPSHOT pom import - - - com.google.gwt - gwt-user - - - com.google.gwt - gwt-servlet - - - com.google.gwt - gwt-dev - - @@ -161,24 +147,43 @@ [1.0.0,2.0.0-SNAPSHOT) compile + + + + org.gcube.common + common-jaxrs-client + [1.0.0, 2.0.0-SNAPSHOT) + + + + org.gcube.common + metadata-profile-discovery + [1.0.0-SNAPSHOT, 1.1.0-SNAPSHOT) + org.gcube.application geoportal-data-common - [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT) + [1.0.0-SNAPSHOT, 1.5.0-SNAPSHOT) compile org.gcube.application geoportal-client - [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT) + [1.0.0, 1.0.7] compile org.gcube.resources.discovery ic-client + + org.ow2.asm + asm + + + org.gcube.common keycloak-client diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java index 953db43..345e0e2 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java @@ -81,7 +81,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme GNADataViewerConfigProfile profile = SessionUtil.getGNADataViewerConfigProfile(getThreadLocalRequest()); if (profile == null) { LOG.info(GNADataViewerConfigProfile.class.getSimpleName() + " is null, loading configurations from IS"); - //to be sure + // to be sure SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true); GeoportalCommon geoportalComm = new GeoportalCommon(); profile = geoportalComm.readGNADataViewerConfig(null); @@ -740,7 +740,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme LOG.info("getListConcessioni called wit start: " + start + ", limit: " + limit + ", filter: " + filter); try { - + // setting identity as D4S User or KC client + new ConcessioniMongoServiceIdentityProxy(this.getThreadLocalRequest()); SessionUtil.getCurrentContext(getThreadLocalRequest(), true); MongoServiceCommon serviceCommon = new MongoServiceCommon(); // TODO MUST BE REPLACED BY COUNT diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/mongoservice/ConcessioniMongoServiceIdentityProxy.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/mongoservice/ConcessioniMongoServiceIdentityProxy.java index 735f381..5fd7bb7 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/mongoservice/ConcessioniMongoServiceIdentityProxy.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/mongoservice/ConcessioniMongoServiceIdentityProxy.java @@ -38,8 +38,11 @@ public class ConcessioniMongoServiceIdentityProxy { String username = null; try { username = pContext.getCurrentUser(request).getUsername(); + if(username==null || username.isEmpty()) + throw new Exception("Invalid username"); }catch (Exception e) { LOG.info("Username not detected in session"); + username = null; //to be sure that is null and not empty string } if (username != null) { LOG.info("User detected, using its identity");