hryvinskyi / magento2-gdpr-review
Product reviews as an entity of the Magento 2 data-subject requests: export, delete and anonymise a customer's reviews and the IP addresses of their rating votes
Package info
github.com/hryvinskyi/magento2-gdpr-review
Type:magento2-module
pkg:composer/hryvinskyi/magento2-gdpr-review
Requires
- php: ~8.3.0||~8.4.0||~8.5.0
- hryvinskyi/magento2-gdpr: ^1.0
- hryvinskyi/magento2-gdpr-api: ^1.0
- magento/framework: *
- magento/module-catalog: *
- magento/module-review: *
- magento/module-store: *
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Adds product reviews to the data-subject requests of hryvinskyi/magento2-gdpr. It contributes through di.xml only. The engine never names this package.
What it does for a store
- Which reviews a subject covers. Every review written by a customer subject's account, oldest first. A guest subject covers none: Magento stores no e-mail address with a review, so a guest review cannot be tied to a person, and a review whose account was deleted keeps no link to it.
- Export. One section,
review, lists each review's product SKU and name, title, text, nickname, status, store, date, the IP addresses its rating votes were cast from (vote_remote_ip, each address once), and one column for each rating the customer's reviews voted on. - Erase and anonymise. The default method is
anonymise: the nickname and the IP address of each rating vote are replaced, and the title, the text and the votes themselves stay, so the product's ratings keep their weight. Adeleterule removes the reviews with their text, store links and rating votes.
Requirements
- Magento Open Source or Adobe Commerce 2.4.8 or 2.4.9, PHP 8.3 to 8.5.
hryvinskyi/magento2-gdpr-api^1.0 andhryvinskyi/magento2-gdpr^1.0.- The platform's Store, Catalog and Review modules.
Installation
Run from the Magento root. hryvinskyi/magento2-gdpr-pack installs this package with the rest of the suite.
composer require hryvinskyi/magento2-gdpr-review
bin/magento module:enable Hryvinskyi_GdprApi Hryvinskyi_Clock Hryvinskyi_RateLimit Hryvinskyi_DocumentExport Hryvinskyi_Logger Hryvinskyi_Gdpr Hryvinskyi_GdprReview
bin/magento setup:upgrade
bin/magento setup:di:compile # production mode only
bin/magento cache:flush
Verify with a dry-run plan for a customer who wrote a review. It changes nothing.
bin/magento gdpr:erase --customer-id=<customer_id> --dry-run
The output lists review with anonymise and the number of reviews the account wrote.
Configuration
None of its own. The entity code is review, its sort order is 600, and its default method is anonymise. Its erasure rule may name method (anonymise or delete) and fields.
| Field code | Field type | What it replaces |
|---|---|---|
nickname |
name |
The review's nickname. |
vote_remote_ip |
ip |
The address of each rating vote, and its numeric form, which is set to 0. |
Stored data
The package creates no table. It reads rows of the review tables and writes the nickname of review_detail and the address of rating_option_vote.
Limits
- Only the reviews of a customer account are reached. A guest's review cannot be tied to an address and stays.
- The title and the text of an anonymised review stay, because they are the content of the review. A store whose customers write personal data into them deletes the reviews instead, with the rule
{"review": {"method": "delete"}}. - Deleting a review outside the admin needs Magento's secure area. The erasure run provides it.
Registrations
| Where | What |
|---|---|
providers of Hryvinskyi\Gdpr\Model\Entity\EntityProviderPool |
review, Hryvinskyi\GdprReview\Model\Provider\ReviewProvider |
The package registers no route, command, cron job, event, plugin or preference.
Extension point
None of its own. The core's README shows how another module adds its own entity provider.
Tests
Run from the Magento root.
- Unit:
vendor/bin/phpunit -c app/code/Hryvinskyi/GdprReview/phpunit.xml.dist. The package's rules are proved against a real database, so the unit suite holds no test. - Integration: the platform's harness in
dev/tests/integration, against its own database, one run at a time.cd dev/tests/integration && php -d memory_limit=4G ../../../vendor/bin/phpunit -c phpunit.xml ../../../app/code/Hryvinskyi/GdprReview/Test/Integration. - Static analysis: PHPStan 2.x at level 10 with the package's
phpstan.neon.dist(phpstan analyse -c app/code/Hryvinskyi/GdprReview/phpstan.neon.dist --level=10), andvendor/bin/phpcs --standard=app/code/Hryvinskyi/GdprReview/phpcs.xml.dist app/code/Hryvinskyi/GdprReview.
Translations
The labels the package shows in exports ship in en_US and 25 more locales: the official languages of the European Union, Norwegian Bokmål and Ukrainian. The translations are machine-made; have them read by a native speaker before a store relies on them, and override a phrase in a theme or a language pack.