Skip to content
Draft
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
1 change: 1 addition & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ const _getDataSubjectsMap = req => {

const addDataSubjectForDetailsEntity = (row, log, req, entity, model) => {
const dataSubjectInfo = getDataSubject(entity, model)
if (!dataSubjectInfo) debugger
const role = dataSubjectInfo.dataSubjectEntity['@PersonalData.DataSubjectRole']
log.data_subject.role ??= role
log.data_subject.type = dataSubjectInfo.dataSubjectEntity.name
Expand Down
15 changes: 15 additions & 0 deletions test/personal-data/crud.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2146,4 +2146,19 @@ describe('personal data audit logging in CRUD', () => {
await POST('/crud-5/A', { text: 'foo' }, { auth: ALICE })
expect(_logs.length).toBe(1)
})

test('triangle', async () => {
const { data: door } = await POST('/crud-5/Door', { text: 'door' }, { auth: ALICE })
try {
const { data: house } = await POST(
'/crud-5/House',
{ text: 'house', doorID: door.ID, windows: [{ text: 'window' /* , doorID: door.ID */ }] },
{ auth: ALICE }
)
expect(_logs.length).toBeGreaterThan(0) //> TODO
} catch (error) {
// current modeling leads to error during data subject lookup starting at Window
expect(error.response.status).toBe(500)
}
})
})
36 changes: 36 additions & 0 deletions test/personal-data/db/schema.cds
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,39 @@ annotate C with @PersonalData : {EntitySemantics: 'DataSubject'} {
ID @PersonalData.FieldSemantics: 'DataSubjectID';
text @PersonalData.IsPotentiallyPersonal;
}

entity House {
key ID : UUID;
text : String;
windows : Composition of many Window on windows.house = $self;
doorID : UUID;
door : Association to one Door on door.ID = doorID;
}

entity Window {
key ID : UUID;
text : String;
house : Association to one House;
// doorID : UUID;
// door : Association to one Door on door.ID = doorID;
}

entity Door {
key ID : UUID;
text : String;
}

annotate House with @PersonalData : {EntitySemantics: 'Other'} {
door @PersonalData.FieldSemantics: 'DataSubjectID';
text @PersonalData.IsPotentiallyPersonal;
}

annotate Window with @PersonalData : {EntitySemantics: 'Other'} {
// door @PersonalData.FieldSemantics: 'DataSubjectID';
text @PersonalData.IsPotentiallyPersonal;
}

annotate Door with @PersonalData : {EntitySemantics: 'DataSubject'} {
ID @PersonalData.FieldSemantics: 'DataSubjectID';
text @PersonalData.IsPotentiallyPersonal;
}
6 changes: 6 additions & 0 deletions test/personal-data/srv/crud-5.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = srv => {
srv.on('*', async function(req, next) {
debugger
return next()
})
}
5 changes: 5 additions & 0 deletions test/personal-data/srv/crud-service.cds
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,16 @@ service CRUD_4 {
}

@path : '/crud-5'
@impl : './crud-5.js'
@requires: 'admin'
service CRUD_5 {

entity A as projection on db.A;
entity B as projection on db.B;
entity C as projection on db.C;

entity House as projection on db.House;
entity Window as projection on db.Window;
entity Door as projection on db.Door;

}