mirror of
https://github.com/projectsend/projectsend.git
synced 2026-09-17 00:55:07 +00:00
6e47d76ba6
Client file sharing, rebuilt from the ground up: a private area per client, resumable uploads, folders, groups and categories, sharing with expiry dates and download limits, comments, file versions, an activity log, a REST API, and sixteen languages. This repository begins here. ProjectSend 2 was developed privately, and that development history is not published — the previous generation remains available, with its own history, at projectsend/legacy. Free software under the GNU General Public License v2, or (at your option) any later version.
47 lines
1.3 KiB
PHP
47 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Modules\Identity\Console;
|
|
|
|
use App\Models\User;
|
|
use App\Modules\Identity\Erasure\AccountEraser;
|
|
use Illuminate\Console\Command;
|
|
|
|
/**
|
|
* Operator tool for erasure requests received out-of-band (GDPR
|
|
* Art. 17): permanently removes the account and anonymizes its
|
|
* activity-log snapshots, immediately.
|
|
*/
|
|
class EraseAccountCommand extends Command
|
|
{
|
|
protected $signature = 'projectsend:erase-account
|
|
{email : Email address of the account to erase}
|
|
{--force : Skip the confirmation prompt}';
|
|
|
|
protected $description = 'Permanently erase an account and anonymize its activity-log entries (GDPR erasure)';
|
|
|
|
public function handle(AccountEraser $eraser): int
|
|
{
|
|
$email = (string) $this->argument('email');
|
|
|
|
$user = User::withTrashed()->where('email', $email)->first();
|
|
|
|
if ($user === null) {
|
|
$this->error("No account found for {$email}.");
|
|
|
|
return self::FAILURE;
|
|
}
|
|
|
|
if (! $this->option('force') && ! $this->confirm("Permanently erase {$user->name} <{$email}> and anonymize their log entries?")) {
|
|
return self::FAILURE;
|
|
}
|
|
|
|
$eraser->erase($user);
|
|
|
|
$this->info('Account erased and log entries anonymized.');
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
}
|