Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: automatically promote entities that are associated with data subjects #92

Merged
merged 3 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading