Skip to content

[wip] reproduce triangle issue #106

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
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 addDataSubjectForDetailsEntity = (row, log, req, entity, model) => {
const dataSubjectInfo = getDataSubject(entity, model)
if (!dataSubjectInfo) debugger

Check failure on line 223 in lib/utils.js

View workflow job for this annotation

GitHub Actions / test (22.x)

Unexpected 'debugger' statement

Check failure on line 223 in lib/utils.js

View workflow job for this annotation

GitHub Actions / test (20.x)

Unexpected 'debugger' statement
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 @@
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(

Check failure on line 2153 in test/personal-data/crud.test.js

View workflow job for this annotation

GitHub Actions / test (22.x)

'house' is assigned a value but never used

Check failure on line 2153 in test/personal-data/crud.test.js

View workflow job for this annotation

GitHub Actions / test (20.x)

'house' is assigned a value but never used
'/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

Check failure on line 3 in test/personal-data/srv/crud-5.js

View workflow job for this annotation

GitHub Actions / test (22.x)

Unexpected 'debugger' statement

Check failure on line 3 in test/personal-data/srv/crud-5.js

View workflow job for this annotation

GitHub Actions / test (20.x)

Unexpected 'debugger' statement
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;

}
Loading