Merge pull request #9442 from AndrewAlesik/main

Added switcher to writing personal data of submitter into dc.description.provenance metadata
This commit is contained in:
Tim Donohue
2024-05-09 15:04:18 -05:00
committed by GitHub
3 changed files with 32 additions and 11 deletions

View File

@@ -28,6 +28,7 @@ import org.dspace.event.Event;
import org.dspace.identifier.Identifier;
import org.dspace.identifier.IdentifierException;
import org.dspace.identifier.service.IdentifierService;
import org.dspace.services.ConfigurationService;
import org.dspace.supervision.SupervisionOrder;
import org.dspace.supervision.service.SupervisionOrderService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -56,6 +57,9 @@ public class InstallItemServiceImpl implements InstallItemService {
Logger log = LogManager.getLogger(InstallItemServiceImpl.class);
@Autowired
protected ConfigurationService configurationService;
protected InstallItemServiceImpl() {
}
@@ -270,14 +274,20 @@ public class InstallItemServiceImpl implements InstallItemService {
// Create provenance description
StringBuffer provmessage = new StringBuffer();
if (item.getSubmitter() != null) {
//behavior to generate provenance message, if set true, personal data (e.g. email) of submitter will be hidden
//default value false, personal data of submitter will be shown in provenance message
String isProvenancePrivacyActiveProperty =
configurationService.getProperty("metadata.privacy.dc.description.provenance", "false");
boolean isProvenancePrivacyActive = Boolean.parseBoolean(isProvenancePrivacyActiveProperty);
if (item.getSubmitter() != null && !isProvenancePrivacyActive) {
provmessage.append("Submitted by ").append(item.getSubmitter().getFullName())
.append(" (").append(item.getSubmitter().getEmail()).append(") on ")
.append(now.toString());
.append(" (").append(item.getSubmitter().getEmail()).append(") on ")
.append(now.toString());
} else {
// else, null submitter
provmessage.append("Submitted by unknown (probably automated) on")
.append(now.toString());
provmessage.append("Submitted by unknown (probably automated or submitter hidden) on ")
.append(now.toString());
}
provmessage.append("\n");

View File

@@ -1191,14 +1191,20 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
// Create provenance description
StringBuffer provmessage = new StringBuffer();
if (myitem.getSubmitter() != null) {
//behavior to generate provenance message, if set true, personal data (e.g. email) of submitter will be hidden
//default value false, personal data of submitter will be shown in provenance message
String isProvenancePrivacyActiveProperty =
configurationService.getProperty("metadata.privacy.dc.description.provenance", "false");
boolean isProvenancePrivacyActive = Boolean.parseBoolean(isProvenancePrivacyActiveProperty);
if (myitem.getSubmitter() != null && !isProvenancePrivacyActive) {
provmessage.append("Submitted by ").append(myitem.getSubmitter().getFullName())
.append(" (").append(myitem.getSubmitter().getEmail()).append(") on ")
.append(now.toString());
.append(" (").append(myitem.getSubmitter().getEmail()).append(") on ")
.append(now.toString());
} else {
// else, null submitter
provmessage.append("Submitted by unknown (probably automated) on")
.append(now.toString());
provmessage.append("Submitted by unknown (probably automated or submitter hidden) on ")
.append(now.toString());
}
if (action != null) {
provmessage.append(" workflow start=").append(action.getProvenanceStartId()).append("\n");

View File

@@ -979,6 +979,11 @@ webui.licence_bundle.show = false
metadata.hide.dc.description.provenance = true
metadata.hide.person.email = true
# Behavior to generate provenance message, if set true,
# personal data (e.g. email) of submitter will be hidden in dc.description.provenance
# Disabled by default. To enable, uncomment the next line
# metadata.privacy.dc.description.provenance = true
##### Settings for Submission Process #####
# Whether or not we REQUIRE that a file be uploaded
@@ -1679,4 +1684,4 @@ include = ${module_dir}/usage-statistics.cfg
include = ${module_dir}/versioning.cfg
include = ${module_dir}/workflow.cfg
include = ${module_dir}/external-providers.cfg
include = ${module_dir}/ldn.cfg
include = ${module_dir}/ldn.cfg