digdir / dialogporten

Dialogporten - common API and and metadata state store for digital dialogs
https://digdir.github.io/dialogporten/
MIT License
0 stars 3 forks source link

Consolidate "seenBy", "performedBy" and "sender" properties to common model #851

Open elsand opened 2 weeks ago

elsand commented 2 weeks ago

Introduction

There is a need for the serviceOwner to supply information about who did what (perform an activity, send a transmission), which matches that of seen log.

Implementation

We create a common entity for this that includes

We need different DTOs for this

The input validation should:

Examples:

ServiceOwner-DTO (output):

{
    "actorType": "user"
    "actorId": "urn:altinn:person:identifier-no:12345678901"
    "actorName": "Ola Nordmann"
}

{
    "actorType": "user"
    "actorId": "urn:altinn:organization:identifier-no:912345678"
    "actorName": "Foretak AS"
}

{
    "actorType": "serviceOwner"
}

ServiceOwner-DTO (input):

{
    "actorType": "user", 
    "actorId": "urn:altinn:person:identifier-no:12345678901"
}

{
    "actorType": "user", 
    "actorId": "urn:altinn:organization:identifier-no:912345679"
}

{
    "actorType": "user", 
    "actorName": "Some custom name"
}

{
    "actorType": "user" // assumed to mean dialog.party
}

Enduser-DTO (person)

{
    "actorType": "endUser",
    "actorName": "Ola Nordmann",
    "actorId": "urn:altinn:person:identifier-ephemeral:0676ad6bdf"
}

Enduser-DTO (organization)

{
    "actorType": "endUser",
    "actorName": "Foretak AS",
    "actorId": "urn:altinn:organization:identifier-no:912345678"
}

Enduser-DTO for seen-log

{
    "actorType": "endUserViaServiceOwner",
    "actorName": "Ola Nordmann",
    "actorId": "urn:altinn:person:identifier-ephemeral:0676ad6bdf"
}
### Tasks
- [ ] Implement as described above
- [ ] Prepare documentation (if relevant - either update working document, or add a new file in `docs`)
- [ ] Add e2e-test (if relevant)
### Threat modelling
- [ ] The identifier hash should be non-stable, ie. not be the same across either application lifetimes (ie. restarts and/or replicas), as this will allow for user identification
- [ ] We are storing PIDs here as well as resolved names. This is presumed to be acceptable as there is a need for secure identification for notority reasons.
- [ ] We are exposing end user names (full names). This is PII.

Acceptance criteria

GIVEN ... WHEN .... THEN ...

GIVEN ... WHEN .... THEN ...

oskogstad commented 1 week ago

@elsand IsCurrentEndUser is missing from the new model, I assume it is still needed?