Improved authorship checking code
This commit is contained in:
parent
1060843069
commit
00d60021fc
|
@ -243,7 +243,9 @@ public class CKANPackage extends CKAN implements Moderated {
|
||||||
if(result.get(AUTHOR_EMAIL_KEY).asText().compareTo(authorEmail)!=0) {
|
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.");
|
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;
|
return objectNode;
|
||||||
|
@ -339,6 +341,8 @@ public class CKANPackage extends CKAN implements Moderated {
|
||||||
objectNode.put(MAINTAINER_KEY, authorName);
|
objectNode.put(MAINTAINER_KEY, authorName);
|
||||||
objectNode.put(MAINTAINER_EMAIL_KEY, authorEmail);
|
objectNode.put(MAINTAINER_EMAIL_KEY, authorEmail);
|
||||||
}else {
|
}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());
|
objectNode.put(MAINTAINER_KEY, objectNode.get(MAINTAINER_EMAIL_KEY).toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue