From 00d60021fc99f19d90f312fc37228640cc348933 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Mon, 3 Oct 2022 14:06:48 +0200 Subject: [PATCH] Improved authorship checking code --- .../java/org/gcube/gcat/persistence/ckan/CKANPackage.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/gcube/gcat/persistence/ckan/CKANPackage.java b/src/main/java/org/gcube/gcat/persistence/ckan/CKANPackage.java index 7cec842..f0496f6 100644 --- a/src/main/java/org/gcube/gcat/persistence/ckan/CKANPackage.java +++ b/src/main/java/org/gcube/gcat/persistence/ckan/CKANPackage.java @@ -243,7 +243,9 @@ public class CKANPackage extends CKAN implements Moderated { if(result.get(AUTHOR_EMAIL_KEY).asText().compareTo(authorEmail)!=0) { throw new BadRequestException("Only Catalogue-Admins or above can change the authorship (i.e. " + AUTHOR_EMAIL_KEY + " field) of an item."); } - + }else { + // The service can't perform any check on author information provide by Catalogue-Admin or above, + // so the service assumes the information provided as correct. } } return objectNode; @@ -339,6 +341,8 @@ public class CKANPackage extends CKAN implements Moderated { objectNode.put(MAINTAINER_KEY, authorName); objectNode.put(MAINTAINER_EMAIL_KEY, authorEmail); }else { + // We could try to retrieve Surname and Name of the maintainer if + // he/she is present as user in the VRE or in the catalogue. objectNode.put(MAINTAINER_KEY, objectNode.get(MAINTAINER_EMAIL_KEY).toString()); } }