Skip to content

Commit a74cbad

Browse files
authored
feat: automatically promote entities that are associated with data subjects (#92)
1 parent 0870be5 commit a74cbad

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44
This project adheres to [Semantic Versioning](http://semver.org/).
55
The format is based on [Keep a Changelog](http://keepachangelog.com/).
66

7+
## Version 0.7.0 - tbd
8+
9+
### Added
10+
11+
- Automatically promote entities that are associated with data subjects
12+
713
## Version 0.6.0 - 2024-02-05
814

915
### Added

cds-plugin.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@ cds.on('served', services => {
1919
for (const entity of service.entities) if (hasPersonalData(entity)) relevantEntities.push(entity)
2020
if (!relevantEntities.length) continue
2121

22+
// automatically promote entities that are associated with data subjects
23+
for (const entity of relevantEntities) {
24+
if (entity['@PersonalData.EntitySemantics'] !== 'DataSubject') continue
25+
for (const e of service.entities) {
26+
for (const k in e.associations) {
27+
if (e.associations[k].target === entity.name && k !== 'SiblingEntity') {
28+
e['@PersonalData.EntitySemantics'] ??= 'Other'
29+
e.associations[k]['@PersonalData.FieldSemantics'] ??= 'DataSubjectID'
30+
if (!relevantEntities.includes(e)) relevantEntities.push(e)
31+
}
32+
}
33+
}
34+
}
35+
2236
for (const entity of relevantEntities) {
2337
/*
2438
* data access

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cap-js/audit-logging",
3-
"version": "0.6.0",
3+
"version": "0.7.0",
44
"description": "CDS plugin providing integration to the SAP Audit Log service as well as out-of-the-box personal data-related audit logging based on annotations.",
55
"repository": "cap-js/audit-logging",
66
"author": "SAP SE (https://www.sap.com)",

0 commit comments

Comments
 (0)