From c1564c0517f8015b729ee0882c1a76c02e12e6b2 Mon Sep 17 00:00:00 2001 From: Ian Date: Thu, 10 Oct 2024 08:35:40 -0300 Subject: [PATCH] Remove spaces from the list of schema list of metadata import restrictions so that "iso19115-3.2018, dublin-core" will also work. (#8408) Also updated the admin documentation so that it is clear that it expect to get a comma separated list. --- .../geonet/kernel/datamanager/base/BaseMetadataManager.java | 6 +++++- web-ui/src/main/resources/catalog/locales/en-admin.json | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/fao/geonet/kernel/datamanager/base/BaseMetadataManager.java b/core/src/main/java/org/fao/geonet/kernel/datamanager/base/BaseMetadataManager.java index f2f159c029c..7464a267735 100644 --- a/core/src/main/java/org/fao/geonet/kernel/datamanager/base/BaseMetadataManager.java +++ b/core/src/main/java/org/fao/geonet/kernel/datamanager/base/BaseMetadataManager.java @@ -582,7 +582,11 @@ public AbstractMetadata insertMetadata(ServiceContext context, AbstractMetadata // Check if the schema is allowed by settings String mdImportSetting = settingManager.getValue(Settings.METADATA_IMPORT_RESTRICT); - if (mdImportSetting != null && !mdImportSetting.equals("")) { + if (mdImportSetting != null) { + // Remove spaces from the list so that "iso19115-3.2018, dublin-core" will also work + mdImportSetting = mdImportSetting.replace(" ", ""); + } + if (!StringUtils.isBlank(mdImportSetting)) { if (!newMetadata.getHarvestInfo().isHarvested() && !Arrays.asList(mdImportSetting.split(",")).contains(schema)) { throw new IllegalArgumentException("The system setting '" + Settings.METADATA_IMPORT_RESTRICT + "' doesn't allow to import " + schema diff --git a/web-ui/src/main/resources/catalog/locales/en-admin.json b/web-ui/src/main/resources/catalog/locales/en-admin.json index 1a711de4150..81d7da738e0 100644 --- a/web-ui/src/main/resources/catalog/locales/en-admin.json +++ b/web-ui/src/main/resources/catalog/locales/en-admin.json @@ -868,7 +868,7 @@ "metadata/workflow/forceValidationOnMdSave-help": "When the metadata is saved force validation check", "metadata/import": "Metadata import", "metadata/import/restrict": "Restrict import to schemas", - "metadata/import/restrict-help": "List of all allowed schemas for metadata to be imported. If the metadata schema is not allowed, then the import is not done. No value means all schemas allowed.", + "metadata/import/restrict-help": "Comma separated list of all allowed schemas for metadata to be imported. If the metadata schema is not allowed, then the import is not done. No value means all schemas allowed.", "metadata/import/userprofile": "Minimum user profile allowed to import metadata", "metadata/import/userprofile-help": "Minimum user profile allowed to import metadata (Editor, Reviewer or Administrator). The default value is Editor.", "metadata/delete": "Metadata delete",