FEATURE: Allow admins to export users (#30918)

The GDPR requires all users to be able to export their data, or request an export of their data. This is fine for active users as we have a data export button on user profiles, but suspended users have no way of accessing the data export function, and the workaround for admins to export data for suspended users involves temporarily unsuspending them, then impersonating the user to export the data as them.

Since suspended users no longer have access to their account, we can safely assume that the export request will be coming via a medium outside of Discourse (eg, email). This change is built with this workflow in mind.

This change adds a new "User exports" section to the admin user page, allowing admins to start a new export, and to download the latest export file.
This commit is contained in:
Gary Pendergast
2025-01-24 08:13:25 +11:00
committed by GitHub
parent 3070b8eeae
commit 7fc8d74f3e
18 changed files with 404 additions and 13 deletions

View File

@@ -6963,6 +6963,19 @@ en:
approve_bulk_success: "Success! All selected users have been approved and notified."
time_read: "Read Time"
post_edits_count: "Post Edits"
exports:
title: User exports
download:
description: Download latest export
expires_in:
one: Expires in %{count} hour
other: Expires in %{count} hours
not_available: No export available
button: Request archive
confirm: Do you really want to create an archive of this user's activity and preferences?
started: We've started collecting collecting the archive, the download link will update when the process is complete.
success: The archive is ready for download.
export_failed: We're sorry, but the export failed. Please check the logs for further information.
anonymize: "Anonymize User"
anonymize_confirm: "Are you sure you want to anonymize this account? This will change the username and email, and reset all profile information."
delete_associated_accounts_confirm: "Are you sure you want to delete all associated accounts from this account? The user may not be able to log in if their email has changed."

View File

@@ -1517,6 +1517,7 @@ Discourse::Application.routes.draw do
post "/export_csv/export_entity" => "export_csv#export_entity",
:as => "export_entity_export_csv_index"
get "/export_csv/latest_user_archive/:user_id.json" => "export_csv#latest_user_archive"
get "onebox" => "onebox#show"
get "inline-onebox" => "inline_onebox#show"