Ana içeriğe geç
Versiyon: 2.x

GDPR

GDPR Data Management: members can export their data or ask for erasure. Admins choose deletion or anonymization. Bundled with Flarum 2.0.

The GDPR extension (flarum/gdpr) gives your members control over their personal data, and gives you the tools to handle their requests. It is a bundled extension, and it is disabled by default.

Once it is enabled:

  • Every member gets a Personal data section in their settings, where they can download a copy of their data or ask for their account to be erased.
  • Moderators with the right permission review erasure requests and choose whether to anonymize or delete the account.
  • Confirmed requests nobody handles are processed automatically after 30 days.
  • Deleting a user from the forum becomes a GDPR erasure (see Erasing accounts as a moderator).

The extension handles requests made under the GDPR's right of access and right to erasure. It does not make your forum compliant by itself: what data you collect, why, and for how long is still up to you.

Set up the scheduler first

The automatic parts of this extension are scheduled tasks: processing erasure requests after 30 days, deleting old export files, and clearing stored IP addresses. Without the scheduler, none of them run. Requests wait for a moderator forever, and export archives, which contain personal data, stay on disk. Nothing tells you this is happening.

Requirements​

  • The scheduler, running every minute.
  • Working email. Members confirm an erasure request through a link sent by email.
  • A queue is recommended. Exports and erasures run as queued jobs. On the default sync driver they still work, but they run inside the web request (or the scheduled task) that started them, which can be slow for active accounts.

Kurulum​

The extension ships with Flarum but is not enabled by default. Enable it from the Extensions page of the admin panel, then check the settings and permissions below.

If it is not present in your install, require it like any other package:

composer require flarum/gdpr
php flarum migrate
php flarum cache:clear

Ayarlar​

Find these on the extension's page in the admin panel.

SettingDefaultDescription
Allow anonymization for erasure requestsOnLets moderators erase an account by anonymizing it.
Allow deletion for erasure requestsOffLets moderators erase an account by deleting it, along with everything they posted.
Default action for erasure requestsAnonymizationThe action used when a request is processed automatically after 30 days, and when a moderator erases a user with Erase using default action.
Default username for anonymized usersAnonymousThe username given to anonymized accounts. The ID of the erasure request is added to it, for example Anonymous12.
Keep the default action allowed

The default action must be one of the actions you allow. If the default is Deletion but deletion is not allowed, automatic processing and Erase using default action both fail, and the account is not erased.

İzinler​

The extension adds three permissions on the Permissions page of the admin panel.

PermissionScopeDescription
Process erasure requestsModerateSee confirmed erasure requests and process them with any allowed action. Also lets the holder cancel a pending request.
Request and receive data exports for other usersModerateStart a data export for another member. The export is delivered to the person who asked for it, not to the member.
See anonymized user badgesViewShow an Anonymized User badge on anonymized accounts. Can be granted to guests.

Erasing an account directly from its user controls is available to whoever can delete users, which by default means administrators only.

What members see​

Each member's settings page gets a Personal data section with two buttons.

Exporting data​

Export Data prepares a ZIP archive of the member's data in the background. When it is ready, the member gets a notification and an email with a download link.

The link works once and expires after one day. After it has been downloaded or has expired, the archive is deleted from the server by the next run of gdpr:destroy-exports. The download records when the file was fetched, with the IP address and browser.

The archive contains:

  • A text file naming the forum, the account and the date of the export.
  • The member's row from the users table, without the ID, password, groups or anonymized flag.
  • Their avatar.
  • Their public comment posts (content, date, IP address and discussion ID) and the discussions they started (title and date).
  • Their access tokens, API keys, email and password tokens and connected login providers, without the token values.
  • Anything that other installed extensions add to the export.

Requesting erasure​

Erase Account asks the member for their password and an optional reason, then emails them a confirmation link. The link opens a page where they confirm with Confirm erasure, and the request only reaches moderators once they do. Members who are logged in as a different account cannot confirm someone else's request; logged-out visitors with the link can.

Opening the link doesn't confirm the request by itself, so mail security scanners, which open links in incoming mail, can't confirm it for the member. This applies from Flarum 2.0.1. Before then, opening the link confirmed the request.

Until the request is processed, the member can cancel it from the same place. A moderator with Process erasure requests can also cancel it. The member gets a notification and an email when a request is cancelled, and a final email when their account has been erased.

Handling erasure requests​

Users with Process erasure requests see an Account Erasure Requests dropdown in the forum header whenever there are confirmed requests. Each request shows when it was made, when it was confirmed, the member's reason, and the date it becomes eligible for automatic processing.

Processing a request asks for an optional comment, then offers a button for each allowed action: Anonymize user and Delete user. The erasure runs as a queued job.

Automatic processing​

Confirmed requests that are still waiting 30 days after confirmation are processed by the daily gdpr:process-erase-requests task with the default action. These are recorded as processed by the system rather than by a person.

Anonymization​

Anonymization keeps the member's posts and discussions in place but removes who wrote them:

  • The username becomes the default anonymous username plus the request ID, and the email becomes <username>@flarum-gdpr.local.
  • The password is replaced with a random one, preferences are reset, and the account is removed from all groups.
  • The other columns on the users table are cleared, apart from counts such as the number of posts. This includes data that extensions store there, such as a nickname or bio.
  • The avatar is deleted, along with all access tokens, API keys and connected login providers.
  • IP addresses are removed from all their posts.

An anonymized account cannot be acted on afterwards: every permission check against it is denied except deleting it. Its data can no longer be exported by anyone else.

Deletion​

Deletion removes all the member's posts, their avatar and their tokens, then deletes the account itself. Data that other tables link to the account with a database cascade goes with it.

From Flarum 2.0.1, the discussions they posted in are left as if each of their posts had been deleted on its own:

  • A discussion with no posts left is deleted.
  • A discussion they started that others replied to stays, and now begins at the first remaining reply. It keeps its original start date, and its author is shown as a deleted user.
  • Each discussion's reply count, participant count and last post are recalculated. With Tags enabled, so is each tag's most recent discussion.
  • Notifications about their posts are removed.

Erasing accounts as a moderator​

With GDPR enabled, the Delete button in a user's controls is replaced by Erase. It does not need a request from the member:

  • Erase using default action erases the account with the default action.
  • If both actions are allowed, separate Anonymize user and Delete user buttons are offered as well.

The same applies to DELETE /api/users/{id} through the REST API, which accepts an optional gdprMode of anonymization or deletion in the request body.

Removing spam accounts

With the default settings, erasing a spam account anonymizes it, so its posts stay on the forum under an anonymous name. To remove the posts as well, allow deletion and use Delete user, or remove the posts first.

Reviewing what is covered​

The GDPR Integrations page, linked in the admin navigation and from the extension's settings, lists every registered data type with what happens to it on export, anonymization and deletion, and which extension registered it. It also lists users table columns that are handled specially, and which fields are treated as personal data.

Check it before choosing your actions. Data stored by an extension is only covered if that extension registers it with GDPR; anything else stays where it is when an account is anonymized, and is not included in exports.

The bundled Messages extension registers private messages: a member's messages are included in their export, lose their IP addresses when the account is anonymized, and are deleted when it is deleted. Nobody can message an anonymized account.

Scheduled tasks​

These run daily through the scheduler. You can also run them by hand.

CommandDescription
php flarum gdpr:process-erase-requestsProcesses confirmed requests older than 30 days with the default action.
php flarum gdpr:destroy-exportsDeletes export archives that have been downloaded or have expired.
php flarum gdpr:clear-confirmation-ipsClears the IP address recorded when a request was confirmed, 90 days after confirmation.

Using a separate queue​

Exports and erasures can be slow. If your forum runs named queues, you can route all of this extension's jobs to one of them in your extend.php:

use Flarum\Extend;
use Flarum\Gdpr\Jobs\GdprJob;

return [
// Routes every GDPR job (erasures and exports), which both extend GdprJob.
(new Extend\Queue())
->route(GdprJob::class, 'low'),
];

Export storage​

Export archives are written to the gdpr-export filesystem disk, which defaults to storage/gdpr-exports. They contain personal data, so make sure that directory is not served by your web server.

Audit log​

When the Audit extension is enabled, requests, confirmations, cancellations, erasures and exports are all recorded. See Flarum GDPR in Audit's list of logged actions.

Known limitations​

  • Posts and discussions marked as private by an extension are not included in exports unless that extension adds them.
For developers

If your extension stores personal data, register it so it is exported, anonymized and deleted along with the rest of the account. See Integrating with GDPR.