Skip to content

Commit

Permalink
add an optional domain filter for the list of reports
Browse files Browse the repository at this point in the history
verinice-veo#3180
  • Loading branch information
jochenkemnade committed Sep 27, 2024
1 parent db60729 commit 15b2a88
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/main/java/org/veo/reporting/ReportConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class ReportConfiguration {
@JsonCreator
public ReportConfiguration(
@JsonProperty(value = "name", required = true) Map<String, String> name,
@JsonProperty(value = "domainName", required = false) String domainName,
@JsonProperty(value = "description", required = true) Map<String, String> description,
@JsonProperty(value = "templateFile", required = true) String templateFile,
@JsonProperty(value = "templateType", required = true) String templateType,
Expand All @@ -49,6 +50,7 @@ public ReportConfiguration(
@JsonProperty(value = "targetTypes", required = true) Set<TypeSpecification> targetTypes,
@JsonProperty(value = "data", required = true) Map<String, String> data) {
this.name = Map.copyOf(name);
this.domainName = domainName;
this.description = Map.copyOf(description);
this.templateFile = templateFile;
this.templateType = templateType;
Expand All @@ -60,6 +62,8 @@ public ReportConfiguration(

private final Map<String, String> name;

private final String domainName;

private Map<String, String> description;

private final String templateFile;
Expand All @@ -79,6 +83,11 @@ public Map<String, String> getName() {
return name;
}

@JsonIgnore
public String getDomainName() {
return domainName;
}

@SuppressFBWarnings(EI_EXPOSE_REP)
public Map<String, String> getDescription() {
return description;
Expand Down
15 changes: 12 additions & 3 deletions src/main/java/org/veo/reporting/controllers/ReportController.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.server.ResponseStatusException;
Expand Down Expand Up @@ -92,14 +93,22 @@ public ReportController(
}

/**
* @return the available reports
* @return the available reports, optionally filtered by domain name
*/
@GetMapping
public ResponseEntity<Map<String, ReportConfiguration>> getReports(WebRequest request) {
public ResponseEntity<Map<String, ReportConfiguration>> getReports(
WebRequest request, @RequestParam(name = "domain", required = false) String domainName) {
if (request.checkNotModified(buildTime)) {
return null;
}
return ResponseEntity.ok().cacheControl(CacheControl.noCache()).body(reportEngine.getReports());
Map<String, ReportConfiguration> reports = reportEngine.getReports();
if (domainName != null) {
reports =
reports.entrySet().stream()
.filter(e -> domainName.equals(e.getValue().getDomainName()))
.collect(Collectors.toMap(Entry::getKey, Entry::getValue));
}
return ResponseEntity.ok().cacheControl(CacheControl.noCache()).body(reports);
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/reports/dp-impact-assessment.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": {
"de": "Datenschutz-Folgenabschätzung"
},
"domainName": "DS-GVO",
"description": {
"de": "Eine Auflistung der Informationen zu durchgeführten Datenschutz-Folgenabschätzungen"
},
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/reports/dp-privacy-incident.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"de": "Meldeformular Datenschutzvorfall",
"en": "Notification form for personal data breach"
},
"domainName": "DS-GVO",
"description": {
"de": "Eine detaillierte Übersicht über die dokumentierten Datenschutzvorfälle einer Verantwortlichen",
"en": "A detailed overview of a controller’s documented data protection breaches"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"de": "Betroffenenanfrage",
"en": "Request from data subject"
},
"domainName": "DS-GVO",
"description": {
"de": "Eine detaillierte Darstellung einrr dokumentierten Betroffenenanfrage",
"en": "A detailed view of a documented request from a data subject"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"de": "Übersicht Betroffenenanfragen",
"en": "Overview of requests from data subjects"
},
"domainName": "DS-GVO",
"description": {
"de": "Eine Übersicht über die dokumentierten Betroffenenanfragen einer Verantwortlichen",
"en": "An overview of a controller’s documented requests from data subjects"
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/reports/itbp-a1.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": {
"de": "A.1 Strukturanalyse"
},
"domainName": "IT-Grundschutz",
"description": {
"de": "Eine Übersicht über die Geschäftsprozesse und die verschiedenen Assets"
},
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/reports/itbp-a2.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": {
"de": "A.2 Schutzbedarfsfeststellung"
},
"domainName": "IT-Grundschutz",
"description": {
"de": "Eine Übersicht der Schutzbedarfsfeststellung"
},
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/reports/itbp-a3.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": {
"de": "A.3 Modellierung"
},
"domainName": "IT-Grundschutz",
"description": {
"de": "Eine Übersicht über die Zielobjekte und modellierten Bausteine"
},
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/reports/itbp-a4.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": {
"de": "A.4 Ergebnis des IT-Grundschutz-Checks"
},
"domainName": "IT-Grundschutz",
"description": {
"de": "Eine Übersicht über den Umsetzungsstatus der Anforderungen"
},
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/reports/itbp-a5.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": {
"de": "A.5 Risikoanalyse"
},
"domainName": "IT-Grundschutz",
"description": {
"de": "Eine Übersicht über die Risiken und deren mitigierenden Maßnahmen"
},
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/reports/itbp-a6.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": {
"de": "A.6 Realisierungsplan"
},
"domainName": "IT-Grundschutz",
"description": {
"de": "Eine Übersicht über die bestehenden Defizite bei der Umsetzung von Sicherheitsmaßnahmen"
},
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/reports/processing-activities.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": {
"de": "Verzeichnis der Verarbeitungstätigkeiten"
},
"domainName": "DS-GVO",
"description": {
"de": "Eine detaillierte Übersicht über die in einem Scope durchgeführten Verarbeitungstätigkeiten"
},
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/reports/processing-on-behalf.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"de": "Auftragsverarbeitungen gemäß Art. 30 II DS-GVO",
"en": "Record of processing activities (processor) according to Art. 30 II GDPR"
},
"domainName": "DS-GVO",
"description": {
"de": "Dokumentation über die Auftraggeber und für sie durchgeführte Verarbeitungstätigkeiten (Auftragsverarbeitung)",
"en": "Record of all categories of processing activities carried out on behalf of a controller"
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/reports/risk-analysis.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": {
"de": "Datenschutz-Risikoanalyse"
},
"domainName": "DS-GVO",
"description": {
"de": "Die bestehenden Risiken für die Verarbeitungstätigkeiten in einer verantwortlichen Stelle"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,22 @@ public class ReportControllerSpec extends ReportingTest {
]
}

def "retrieve a list of reports for a domain"() {
when:
def response = GET("/reports?domain=DS-GVO")
def reports = new JsonSlurper().parseText(response.contentAsString)
then:
reports.keySet() ==~ [
'processing-activities',
'processing-on-behalf',
'risk-analysis',
'dp-impact-assessment',
'dp-privacy-incident',
'dp-requests-from-data-subjects-overview',
'dp-request-from-data-subject'
]
}

def "Report configuration has the expected format"() {
when:
def response = GET("/reports")
Expand Down

0 comments on commit 15b2a88

Please sign in to comment.