Skip to content

Commit

Permalink
Merge pull request #1005 from geonetwork/forum
Browse files Browse the repository at this point in the history
Update communication options with geonetwork-ui user forum
  • Loading branch information
jahow authored Sep 26, 2024
2 parents f501972 + 43f0d6f commit 4892c30
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 117 deletions.
109 changes: 9 additions & 100 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,15 @@

# GeoNetwork UI

GeoNetwork UI is a suite of Applications made to provide a modern facade to your GeoNetwork 4 catalog.
GeoNetwork-UI provides several applications to improve the user experience of your GeoNetwork catalog.

It also provides Web Components to embed various parts of your data catalog in third party websites.

## Documentation
End users are [invited](https://discourse.osgeo.org/t/about-the-geonetwork-ui-category/59280) to join us on the GeoNetwork-UI forum on OsGeo Discourse: https://discourse.osgeo.org/c/geonetwork/ui

To check out docs, visit [geonetwork-ui website](https://geonetwork.github.io/geonetwork-ui/main/docs/)
Developers should check out the [GitHub discussions](https://github.com/geonetwork/geonetwork-ui/discussions).

## Requirements

- GeoNetwork version 4.2.2
- ElasticSearch version 7.11+

:warning: A bug currently in GeoNetwork 4.2.2 prevents the organizations of showing up correctly in the Datahub application.

As a temporary workaround, the following change is necessary in GeoNetwork data directory:

```diff
diff --git a/web/src/main/webResources/WEB-INF/data/config/index/records.json b/web/src/main/webResources/WEB-INF/data/config/index/records.json
index 1d7e499af7..78e682e3db 100644
--- a/web/src/main/webResources/WEB-INF/data/config/index/records.json
+++ b/web/src/main/webResources/WEB-INF/data/config/index/records.json
@@ -1317,7 +1317,7 @@
"mapping": {
"type": "nested",
"properties": {
- "org": {
+ "organisation": {
"type": "keyword"
},
"role": {
```
To learn more about the project, visit the [GeoNetwork-UI website](https://geonetwork.github.io/geonetwork-ui/main/docs/)

## Getting started

Expand Down Expand Up @@ -99,67 +76,6 @@ npx nx build (app_name)

The build artifacts will be stored in the `dist/` directory. Note: this always produces a production build.

### A word on authentication

GeoNetwork-UI applications rely on the GeoNetwork authentication mechanism. This means that if the user is authenticated in GeoNetwork, they will have access to authenticated features in the corresponding GeoNetwork-UI apps.

There are a few caveats, depending on the deployment scenario:

#### 1. GeoNetwork and GeoNetwork-UI are deployed on the same host, e.g. https://my.host/geonetwork and https://my.host/datahub

In this scenario, requests from the GeoNetwork-UI app to GeoNetwork are _not_ [cross-origin requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#what_requests_use_cors), so CORS rules do not apply.

GeoNetwork has an XSRF protection by default, which _will_ make authenticated requests fail unless the following is done:

- either make sure that the XSRF cookies sent by GeoNetwork have a `path` value of `/`; this is typically done like so in GeoNetwork:

```diff
--- a/web/src/main/webapp/WEB-INF/config-security/config-security-core.xml
+++ b/web/src/main/webapp/WEB-INF/config-security/config-security-core.xml
@@ -361,6 +361,7 @@
<bean class="org.fao.geonet.security.web.csrf.CookieCsrfTokenRepository"
id="csrfTokenRepository">
<property name="cookieHttpOnly" value="false"/>
+ <property name="cookiePath" value="/"/>
</bean>
```

Also make sure that the GeoNetwork API URL used by the application is _not_ an absolute URL; a relative URL should be enough in that scenario:

```diff
--- a/conf/default.toml
+++ b/conf/default.toml
@@ -5,7 +5,7 @@
[global]
-geonetwork4_api_url = "https://my.host/geonetwork/srv/api"
+geonetwork4_api_url = "/geonetwork/srv/api"
```

- or disable the XSRF protection selectively for non-critical endpoints of GeoNetwork, e.g. https://my.host/geonetwork/srv/api/userSelections for marking records as favorites; this is typically done like so in GeoNetwork:

```diff
--- a/web/src/main/webapp/WEB-INF/config-security/config-security-core.xml
+++ b/web/src/main/webapp/WEB-INF/config-security/config-security-core.xml
@@ -374,6 +374,9 @@
<value>/[a-zA-Z0-9_\-]+/[a-z]{2,3}/csw!?.*</value>
<value>/[a-zA-Z0-9_\-]+/api/search/.*</value>
<value>/[a-zA-Z0-9_\-]+/api/site</value>
+ <value>/[a-zA-Z0-9_\-]+/api/userselections.*</value>
</set>
</constructor-arg>
</bean>
```

:warning: Please do this responsibly as this could have security implications! :warning:

#### 2. GeoNetwork and GeoNetwork-UI are _not_ deployed on the same host, e.g. https://my.host/geonetwork and https://another.org/datahub

In this scenario, even if CORS settings are correctly set up on GeoNetwork side, most authenticated request will probably fail because by default they are not sent with the [`withCredentials: true`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials) option.

As such, **authenticated requests are not yet supported in GeoNetwork-UI in the case of a cross-origin deployment**; non-authenticated requests (e.g. public search) should still work provided CORS settings were correctly set up on the GeoNetwork side (see [CORS resonse headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#the_http_response_headers)).

Lastly, even if authenticated requests were cleared regarding CORS rules, it would still be needed to disable the XSRF mechanism for the endpoints that GeoNetwork-UI relies on; XSRF protections works by making the client read the content of an HTTP cookie, and that is forbidden in a cross-origin context

### Tests

#### Unit tests
Expand All @@ -183,31 +99,24 @@ npx nx test --test-match=/data/dev/gn/ui/libs/common/src/lib/services/bootstrap.

#### End-to-end-tests

You can test the datahub app by page :

- home page
- search page
- organisations page
- dataset pages

##### To run the tests with the interface :
##### To run the tests with the interface:

Start docker from 'support-services', and then in the 'geonetwork-ui' folder :
Start docker from 'support-services', and then in the project root folder :

```shell script
npx nx e2e appname --watch
npx nx e2e (app_name) --watch
```

Then select the file(s) you want to test in the interface.

##### To run the tests without interface :

Start docker from 'support-services', and then in the 'geonetwork-ui' folder :
Start docker from 'support-services', and then in the project root folder :

--> ALl tests :

```shell script
npx nx e2e appname
npx nx e2e (app_name)
```

## Project structure
Expand Down
6 changes: 3 additions & 3 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default defineConfig({
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: 'Guide', link: '/guide/why', activeMatch: '/guide/' },
{ text: 'Guide', link: '/guide/introduction', activeMatch: '/guide/' },
{
text: 'Reference',
link: '/reference/principles',
Expand Down Expand Up @@ -49,7 +49,7 @@ function sidebarGuide() {
{
text: 'Guide',
items: [
{ text: 'Why?', link: '/guide/why' },
{ text: 'Introduction', link: '/guide/introduction' },
{ text: 'Prerequisites', link: '/guide/prerequisites' },
{ text: 'Deploy', link: '/guide/deploy' },
{ text: 'Configure', link: '/guide/configure' },
Expand All @@ -76,7 +76,7 @@ function sidebarGuide() {
items: [
{ text: 'Development environment', link: '/guide/dev-environment' },
{ text: 'Create a Pull Request', link: '/guide/create-a-pr' },
{ text: 'Best practices', link: '/guide/best-practices' },
{ text: 'Code guide', link: '/guide/code-guide' },
{ text: 'Versioning', link: '/guide/versioning' },
],
},
Expand Down
34 changes: 34 additions & 0 deletions docs/guide/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
outline: deep
---

# Introduction

## Why GeoNetwork-UI ?

The GeoNetwork-UI project has been conceived as a way to depart from the long-standing and hard-to-use GeoNetwork interface,
and offer new functionalities and better user experience on top of the existing GeoNetwork API. Its core functionalities are
a **powerful search engine**, various **data visualization** components, and a better support for **non-geographic and open data** resources.

Read the [Vision](./vision.html) section to understand better which approach is being adopted for this project and why.

GeoNetwork-UI offers different applications suited to different use-cases. Applications are documented
in the [corresponding section](../apps/datahub.html).

## Community

GeoNetwork-UI is an open-source project just like GeoNetwork core, and is licensed under GPL-2.0. It is developed by a community of contributors from various organizations, mny of them also involved in the development of the GeoNetwork core project.

### Contribution

If you want to contribute, please read the guides in the "contributing" section of this website. You should also read the [Contribution Guide](https://github.com/geonetwork/geonetwork-ui/tree/main/CONTRIBUTING.md) in the GitHub repository.

### Communication

End users are [invited](https://discourse.osgeo.org/t/about-the-geonetwork-ui-category/59280) to join us on the GeoNetwork-UI forum on OsGeo Discourse: https://discourse.osgeo.org/c/geonetwork/ui

For discussions on technical topics, you should head to the [GitHub discussions](https://github.com/geonetwork/geonetwork-ui/discussions) of the project.

The community can also be reached through the [Gitter room chat](https://app.gitter.im/#/room/#geonetwork_geonetwork-ui:gitter.im) if needed.

Lastly, bugs, issues and improvement requests should be reported on the [GitHub issue tracker](https://github.com/geonetwork/geonetwork-ui/issues). Thank you!
14 changes: 0 additions & 14 deletions docs/guide/why.md

This file was deleted.

0 comments on commit 4892c30

Please sign in to comment.