Improved authorship checking code

This commit is contained in:
Luca Frosini 2022-10-03 14:06:48 +02:00
parent 1060843069
commit 00d60021fc
1 changed files with 5 additions and 1 deletions

View File

@ -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());
}
}