Add configurable data retention: auto-anonymization of inactive customers#244
Open
guillaumeArgiles wants to merge 1 commit into
Open
Conversation
…mers) Enforce the GDPR storage-limitation principle (art. 5.1.e) by anonymizing customers inactive beyond a merchant-configured period. Disabled by default. - CustomerRepository::findInactiveCustomers(): "inactive" = most recent of (last connection, last valid order) older than the configured period. - DataRetentionService: two phases — warn (email + grace window) then anonymize via the existing CustomerService primitive, so orders/invoices are preserved for legal accounting retention while PII is anonymized. - Scheduling: console command `psgdpr:data-retention:run` (with `--dry-run`) plus the actionCronJob hook (ps_cronjobs). No public endpoint. - Back-office "Data retention" configuration tab (enable, inactivity period, warning lead time). - Bilingual (FR/EN) warning email templates. - Audit trail via psgdpr_log (request types: warning, scheduled anonymization).
|
Hello @guillaumeArgiles! This is your first pull request on psgdpr repository of the PrestaShop project. Thank you, and welcome to this Open Source community! |
Member
|
@guillaumeArgiles Please use the PR table in description. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds configurable data retention to the official GDPR module: an opt-in job that anonymizes customers who have been inactive beyond a merchant-defined period, to enforce the GDPR storage-limitation principle (art. 5.1.e). Today the module handles data rights on request (access, export, erasure) but never enforces a retention duration, which the CNIL recommends automating.
Disabled by default — nothing is ever anonymized unless a merchant explicitly enables it and sets a period.
What it does
CustomerRepository::findInactiveCustomers(): a customer is "inactive" when the most recent of (last connection, last valid order) is older than the configured period.DataRetentionService:CustomerServiceprimitive, so orders/invoices are preserved for legal accounting retention (Code de commerce art. L123-22, LPF art. L102 B) while personal data is anonymized.php bin/console psgdpr:data-retention:run(with a--dry-runpreview that sends/changes nothing), plus theactionCronJobhook for theps_cronjobsmodule. No public endpoint.psgdpr_log.Open question for maintainers
The retention job relies on the existing
CustomerService::deleteCustomerDataFromPrestashop()(which usesDeleteCustomerCommand). Could a maintainer confirm the intended behavior of that command on orders and invoices (preserved vs. detached vs. removed)? The feature assumes the active → intermediate-archive → deletion model (anonymize the person, keep legally-required accounting records); I'd like to align on this before considering it final.Test plan
php bin/console psgdpr:data-retention:run --dry-run→ reports how many customers would be warned/anonymized, sending and changing nothing.php bin/console psgdpr:data-retention:run→ inactive customers receive the warning email; entries appear inpsgdpr_log.Notes