hryvinskyi / magento2-gdpr-admin-ui
Admin screens of the GDPR data-subject rights suite: the Stores › Configuration section with an erasure rules field drawn from the installed entities, and the requests grid with its overdue flag and cancel, retry and download actions, the read-only privacy action log, and export, erase and anonymise
Package info
github.com/hryvinskyi/magento2-gdpr-admin-ui
Type:magento2-module
pkg:composer/hryvinskyi/magento2-gdpr-admin-ui
Requires
- php: ~8.3.0||~8.4.0||~8.5.0
- hryvinskyi/magento2-clock: ^1.0
- hryvinskyi/magento2-configuration-fields: ^1.1
- hryvinskyi/magento2-document-export: ^1.0
- hryvinskyi/magento2-gdpr: ^1.0
- hryvinskyi/magento2-gdpr-api: ^1.0
- magento/framework: *
- magento/module-backend: *
- magento/module-config: *
- magento/module-customer: *
- magento/module-newsletter: *
- magento/module-sales: *
- magento/module-security: *
- magento/module-store: *
- magento/module-ui: *
- magento/module-user: *
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
The admin screens of the data-subject rights suite: the settings, the grid of requests and the privacy action log, and the buttons that export, erase or anonymise a person's data from the customer page, the order view and the newsletter subscriber grid. It implements no rule of its own. It calls the services of hryvinskyi/magento2-gdpr.
What it does for a store
- Settings of the whole suite in one section, Stores › Configuration › Hryvinskyi Extensions › Data Subject Rights (GDPR), with a cron editor for the three job schedules and a table of erasure rules that offers each installed entity only the methods and fields it supports.
- Requests grid, Customers › Data Subject Requests: type, status, origin, subject, the customer id linked to the account while it exists, the subject's e-mail while the request holds it, and the request's dates. The respond-by date shows Overdue when the request is late in its own store's day, and the filter finds overdue requests by the same rule. The search looks in the request id only.
- Row actions, each shown only with its permission and while the request allows it: cancel (a failed request too, with a warning that processed data stays processed), retry a failed request, download a completed export's archive, and the request's journal. Cancel and retry are journaled with the signed-in admin.
- Privacy action log, Customers › Privacy Action Log: read-only, filterable on every column, and openable for one request. It shows no subject key, and the module has no route that edits or deletes a journal row.
- Privacy buttons. Export personal data, Erase personal data and Anonymise personal data on the customer edit page and the order view, and a Privacy column on the newsletter subscriber grid, each shown only with its create permission. An order without an account, and a subscription without one, are the guest of their e-mail address in their store's website, and the request names that kind, so an address an account also holds is never taken for the account.
- Confirmation page. It names the subject, shows what the request will do to each entity with the records it holds now, and for an erase or an anonymise asks for the admin's own password with a warning that it cannot be undone.
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,hryvinskyi/magento2-gdpr^1.0,hryvinskyi/magento2-configuration-fields^1.1,hryvinskyi/magento2-document-export^1.0 andhryvinskyi/magento2-clock^1.0.- The platform's Store, Backend, Config, Ui, User, Customer, Sales, Newsletter and Security 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-admin-ui bin/magento module:enable Hryvinskyi_GdprApi Hryvinskyi_Clock Hryvinskyi_RateLimit Hryvinskyi_DocumentExport Hryvinskyi_Logger Hryvinskyi_Gdpr Hryvinskyi_AdminUi Hryvinskyi_ConfigurationFields Hryvinskyi_GdprAdminUi bin/magento setup:upgrade bin/magento setup:di:compile # production mode only bin/magento setup:static-content:deploy -f # production mode only bin/magento cache:flush
After the install, open Customers › Data Subject Requests. The grid is empty until a request exists. A role sees an entry only with the permission behind it.
Access
The resources are defined by hryvinskyi/magento2-gdpr. Grant them in System › Permissions › User Roles, under Role Resources.
| Screen or action | Resource ID |
|---|---|
| Customers › Data Subject Requests | Hryvinskyi_Gdpr::requests |
| Export button and confirmation | Hryvinskyi_Gdpr::request_export |
| Erase button and confirmation | Hryvinskyi_Gdpr::request_erase |
| Anonymise button and confirmation | Hryvinskyi_Gdpr::request_anonymise |
| Cancel action | Hryvinskyi_Gdpr::request_cancel |
| Retry action | Hryvinskyi_Gdpr::request_retry |
| Download action | Hryvinskyi_Gdpr::export_download |
| Customers › Privacy Action Log | Hryvinskyi_Gdpr::action_log |
| The settings section | Hryvinskyi_Gdpr::config |
Configuration
The section is hryvinskyi_gdpr of the Hryvinskyi Extensions tab. The Scope column is the lowest scope a value can be set at. The defaults are shipped by hryvinskyi/magento2-gdpr, and its README describes what each setting does.
| Group › Field | Path | Default | Scope |
|---|---|---|---|
| General › Storefront Privacy Features | hryvinskyi_gdpr/general/enabled |
Yes | store view |
| Requests › Delay Before Erasing or Anonymising (minutes) | hryvinskyi_gdpr/requests/destructive_delay_minutes |
60 | website |
| Requests › Requests From Guests | hryvinskyi_gdpr/requests/guest_enabled |
Yes | store view |
| Requests › Guest Confirmation Link Lifetime (hours) | hryvinskyi_gdpr/requests/guest_confirmation_hours |
24 | website |
| Requests › Guest Attempts per Window | hryvinskyi_gdpr/requests/guest_rate_limit |
5 | website |
| Requests › Guest Attempt Window (minutes) | hryvinskyi_gdpr/requests/guest_rate_window_minutes |
15 | website |
| Export › Formats in the Archive | hryvinskyi_gdpr/export/formats |
JSON, CSV, HTML, PDF | website |
| Export › Archive Lifetime (hours) | hryvinskyi_gdpr/export/archive_lifetime_hours |
168 | website |
| E-mails › Sender | hryvinskyi_gdpr/email/identity |
General Contact | store view |
| E-mails › Request Accepted | hryvinskyi_gdpr/email/request_accepted_template |
Data Subject Request Accepted | store view |
| E-mails › Request Completed | hryvinskyi_gdpr/email/request_completed_template |
Data Subject Request Completed | store view |
| E-mails › Export Ready | hryvinskyi_gdpr/email/export_ready_template |
Data Subject Export Ready | store view |
| E-mails › Guest Confirmation | hryvinskyi_gdpr/email/guest_confirmation_template |
Data Subject Request Confirmation (Guest) | store view |
| Erasure Rules › Rules by Data | hryvinskyi_gdpr/erasure/rules |
empty: every entity's defaults | website |
| Age-Based Anonymisation › Anonymise Old Records | hryvinskyi_gdpr/retention/enabled |
No | default |
| Inactive Subjects › Clean Up Inactive Subjects | hryvinskyi_gdpr/inactivity/enabled |
No | default |
| Inactive Subjects › Inactive For (months) | hryvinskyi_gdpr/inactivity/months |
36 | default |
| Inactive Subjects › Request Created | hryvinskyi_gdpr/inactivity/type |
Anonymise | default |
| Inactive Subjects › Subjects per Run | hryvinskyi_gdpr/inactivity/batch_size |
100 | default |
| Schedules › Run Due Requests | crontab/hryvinskyi_gdpr/jobs/hryvinskyi_gdpr_run_due/schedule/cron_expr |
*/5 * * * * |
default |
| Schedules › Housekeeping | crontab/hryvinskyi_gdpr/jobs/hryvinskyi_gdpr_housekeeping/schedule/cron_expr |
17 * * * * |
default |
| Schedules › Age-Based Anonymisation and Inactive Subjects | crontab/hryvinskyi_gdpr/jobs/hryvinskyi_gdpr_retention/schedule/cron_expr |
40 3 * * * |
default |
| Developer › Write the GDPR Log | hryvinskyi_gdpr/developer/log_enabled |
Yes | default |
A value locked in the deployment configuration (bin/magento config:set --lock-env or --lock-config) shows greyed out and cannot be changed here.
Erasure rules
The Rules by Data field lists one row for each installed entity with the erase method, the fields an anonymisation replaces and, for an entity that is anonymised by age, the months. A row offers only what the entity supports. A save is checked against the installed entities and stored as the JSON the engine reads (the format is in the README of hryvinskyi/magento2-gdpr). A save is refused with the reason when a rule names an entity no installed module provides, a method the entity does not support, a field it does not describe, or months that are not a whole number in range.
Re-authentication
An erase or anonymise request made from the customer edit page, the order view or the newsletter subscriber grid is confirmed with the signed-in admin's own password. A wrong password makes no request, is journaled as reauth_failed and counts toward the admin's sign-in lockout, and a locked admin is signed out. Where the store asks admins for a second sign-in factor, the confirm page still checks the password only; that is the module's re-authentication level. The request is made with origin admin and journaled with the admin's id and username.
Limits
- The request search looks in the request id only. The subject's e-mail is held only until the request is final, and it is not searchable.
- The privacy action log shows no subject key, and no screen or route edits or deletes a log row.
- An export request made from a screen is carried out by cron, so the archive does not appear until the next run. Download it with the Download row action.
- The cancel action of a failed request does not restore anything. What the failed run already erased or anonymised stays so.
Registrations
| Where | What |
|---|---|
| Admin route | frontName hryvinskyi_gdpr, controllers request/index, request/cancel, request/retry, request/download, log/index, subject/confirm, subject/submit |
| Menu | Customers › Data Subject Requests (Hryvinskyi_GdprAdminUi::requests), Customers › Privacy Action Log (Hryvinskyi_GdprAdminUi::action_log) |
| UI components | hryvinskyi_gdpr_request_listing, hryvinskyi_gdpr_action_log_listing, and the buttons added to customer_form |
| Layout handles | hryvinskyi_gdpr_request_index, hryvinskyi_gdpr_log_index, hryvinskyi_gdpr_subject_confirm, newsletter_subscriber_block |
| Plugin | Hryvinskyi\GdprAdminUi\Plugin\Sales\AddOrderViewButtons on Magento\Sales\Block\Adminhtml\Order\View |
| Listing data sources | hryvinskyi_gdpr_request_listing_data_source and hryvinskyi_gdpr_action_log_listing_data_source, over the core's two resource models |
| Row actions | cancel, retry, download, journal in actions of Hryvinskyi\GdprAdminUi\Ui\Component\Listing\Column\RequestActions |
| Page sources | customer, order, subscriber in sources of Hryvinskyi\GdprAdminUi\Model\Admin\SubjectSource\SubjectSources |
| Config backend models | Hryvinskyi\GdprAdminUi\Model\Config\Backend\ErasureRules and the three cron schedule models, which write the job schedules |
Extension points
A privacy button on another admin page
An admin page that shows one person can start a request. A module implements Hryvinskyi\GdprAdminUi\Model\Admin\SubjectSource\SubjectSourceInterface (subject(int $id) and pageUrl(int $id)), adds it to the global pool under a page code, and links its button to hryvinskyi_gdpr/subject/confirm with the query parameters source (the page code), id and type (export, erase or anonymise).
<type name="Hryvinskyi\GdprAdminUi\Model\Admin\SubjectSource\SubjectSources"> <arguments> <argument name="sources" xsi:type="array"> <item name="ticket" xsi:type="object">Vendor\Module\Model\Admin\TicketSubject</item> </argument> </arguments> </type> <type name="Hryvinskyi\GdprAdminUi\Model\Admin\SubjectSourcePermissions"> <arguments> <argument name="resources" xsi:type="array"> <item name="ticket" xsi:type="string">Vendor_Module::tickets</item> </argument> </arguments> </type>
The second declaration names the permission of the page itself. A role may start a request from a page only with the create permission of the type and the permission to open that page; a code with no permission in the map is refused to everyone. A code no source is registered under is a page not found.
Tests
Run from the Magento root.
- Unit:
vendor/bin/phpunit -c app/code/Hryvinskyi/GdprAdminUi/phpunit.xml.dist. - 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/GdprAdminUi/Test/Integration. - Static analysis: PHPStan 2.x at level 10 with the package's
phpstan.neon.dist(phpstan analyse -c app/code/Hryvinskyi/GdprAdminUi/phpstan.neon.dist --level=10), andvendor/bin/phpcs --standard=app/code/Hryvinskyi/GdprAdminUi/phpcs.xml.dist app/code/Hryvinskyi/GdprAdminUi.
Translations
The admin wording ships 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.