Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Rework classes to anonymize users in the background#292

Merged
LorenzoJokhan merged 5 commits intodevelfrom
feature/anonymize-users-in-background
Mar 7, 2023
Merged

Rework classes to anonymize users in the background#292
LorenzoJokhan merged 5 commits intodevelfrom
feature/anonymize-users-in-background

Conversation

@LorenzoJokhan
Copy link
Contributor

@LorenzoJokhan LorenzoJokhan commented Mar 6, 2023

Anonimizing the users of a site on the background.
I have taken an example of the class auth/middleware/code.js

@LorenzoJokhan LorenzoJokhan requested a review from nlsvgtr March 6, 2023 09:18
// extract externalUserIds
result.externalUserIds = result.users.filter( user => user.externalUserId ).map( user => user.externalUserId );

console.log({result});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Een verdwaalde console.log

let users = await db.User.findAll({ where: { externalUserId } });
if (users.length == 0) {
// no api users left for this oauth user, so remove the oauth user
let which = req.query.useOauth || 'default';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

req.query heb je hier niet. Net zo min als req.site en req.params hieronder.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wat is overigens de reden dat je dat nar hier hebt verplaatst? Ik vermoed omdat het in principe netter is om het in het model te doen, maar de reden om het niet hier te doen was dat je nu de instantie Site=12 verantwoordelijk maakt voor users die niet onder site 12 vallen.
Voor beide valt wat te zeggen denk ik....

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, ik zie nu dat je de req meestuurt. Zou je daar losse params van kunnen maken? req is een concept dat niet in een model thuis hoort denk ik.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wat is overigens de reden dat je dat nar hier hebt verplaatst? Ik vermoed omdat het in principe netter is om het in het model te doen, maar de reden om het niet hier te doen was dat je nu de instantie Site=12 verantwoordelijk maakt voor users die niet onder site 12 vallen. Voor beide valt wat te zeggen denk ik....

De users worden opgehaald aan de hand van de result variabele die uit willAnonyizeAllUsers komt. Deze filtert de users op o.a. de siteId van de betreffende site. De doAnonymizeAllUsers wordt slechts op 1 plek gebruikt met deze gefilterde variabele dus users die niks te maken hebben met deze site zullen niet worden geanonymiseerd.

Het is uiteraard wel mogelijk om zo een scenario in te programmeren als je een andere lijst aan users meegeeft aan doAnonymizeAllUsers. Dit is dan wel iets dat je bewust zal programmeren.

Als laatste ben ik van mening dat door het aanreiken van een user lijst aan de functie, in plaats van willAnonyizeAllUsers aanroepen binnen doAnonymizeAllUsers, zorg je ervoor dat mocht willAnonyizeAllUsers veranderen dan hoef je niet de methode doAnonymizeAllUsers aan te passen maar alleen mogelijk de doorgegeven waarde te wijzigen

@LorenzoJokhan LorenzoJokhan requested a review from nlsvgtr March 7, 2023 09:09
@LorenzoJokhan LorenzoJokhan marked this pull request as ready for review March 7, 2023 09:09
@nlsvgtr
Copy link
Collaborator

nlsvgtr commented Mar 7, 2023

Dit lijkt me prima zo.

Heb ik wel een vervolg verzoek: kun je kijken of er iets van feedback mogelijk is.

De netste oplossing zou zijn om eea via actions te laten werken, maar voor nu misschien een beetje overkill.

Voor het genereren van unieke ccodes gebeurd dat in de oauth server. Die heeft wat extra routes om de status van het genereren op te vragen. Nu is dat geen ideale oplossing, maar kijk er eens naar en misschien kun je wat leuks bedenken...

@LorenzoJokhan LorenzoJokhan merged commit ced0f6f into devel Mar 7, 2023
@LorenzoJokhan LorenzoJokhan deleted the feature/anonymize-users-in-background branch March 7, 2023 11:53
LorenzoJokhan pushed a commit that referenced this pull request Apr 20, 2023
* render concept templates for idea when creating or when changed from concept to published

* Added concept templates

* Add check on existing users bofore deleting a site

* Changed mail implementation to allow changing the email in the admin panel

* Added a migration to add type column and exposed it

* Rework classes to anonymize users in the background (#292)

* Rework classes to anonymize users in the background

* remove console.log statement

* Remove task code which does not really seem usefull in any way

* Remove the do check inside method doAnonymizeAllUsers, it will always be in 'do' replace req param with self

* Remove dangling console log statement

* Added length check for checking if there are any users left on the side - [] is truthy (#294)

* Added type field when creating a tag (#295)

* Feature/add conceptmail and concept topublished config (#296)

* Added conceptMail and conceptToPublishedEmail config

* Remove accidental .env

---------

Co-authored-by: Niels Vegter <niels@denes.nl>
LorenzoJokhan pushed a commit that referenced this pull request May 5, 2023
* render concept templates for idea when creating or when changed from concept to published

* Added concept templates

* Add check on existing users bofore deleting a site

* Changed mail implementation to allow changing the email in the admin panel

* Added a migration to add type column and exposed it

* Rework classes to anonymize users in the background (#292)

* Rework classes to anonymize users in the background

* remove console.log statement

* Remove task code which does not really seem usefull in any way

* Remove the do check inside method doAnonymizeAllUsers, it will always be in 'do' replace req param with self

* Remove dangling console log statement

* Added length check for checking if there are any users left on the side - [] is truthy (#294)

* Added type field when creating a tag (#295)

* Feature/add conceptmail and concept topublished config (#296)

* Added conceptMail and conceptToPublishedEmail config

* Remove accidental .env

* Added new regex to also support {ideaId} format used in global url& api instellingen slug setting (#300)

---------

Co-authored-by: Niels Vegter <niels@denes.nl>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants