Skip to content

Commit

Permalink
feat: automatically promote entities that are associated with data su…
Browse files Browse the repository at this point in the history
…bjects (#92)
  • Loading branch information
sjvans authored May 15, 2024
1 parent 0870be5 commit a74cbad
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
The format is based on [Keep a Changelog](http://keepachangelog.com/).

## Version 0.7.0 - tbd

### Added

- Automatically promote entities that are associated with data subjects

## Version 0.6.0 - 2024-02-05

### Added
Expand Down
14 changes: 14 additions & 0 deletions cds-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ cds.on('served', services => {
for (const entity of service.entities) if (hasPersonalData(entity)) relevantEntities.push(entity)
if (!relevantEntities.length) continue

// automatically promote entities that are associated with data subjects
for (const entity of relevantEntities) {
if (entity['@PersonalData.EntitySemantics'] !== 'DataSubject') continue
for (const e of service.entities) {
for (const k in e.associations) {
if (e.associations[k].target === entity.name && k !== 'SiblingEntity') {
e['@PersonalData.EntitySemantics'] ??= 'Other'
e.associations[k]['@PersonalData.FieldSemantics'] ??= 'DataSubjectID'
if (!relevantEntities.includes(e)) relevantEntities.push(e)
}
}
}
}

for (const entity of relevantEntities) {
/*
* data access
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cap-js/audit-logging",
"version": "0.6.0",
"version": "0.7.0",
"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.",
"repository": "cap-js/audit-logging",
"author": "SAP SE (https://www.sap.com)",
Expand Down

0 comments on commit a74cbad

Please sign in to comment.