im profil kann ein nutzer nun seine daten exportieren. man kann seinen account löschen. nach 2 jahren werden inaktive accounts gelöscht, 1 monat vorher wird eine email geschickt. Hilfetexte und Legal Pages in der Guest PWA korrigiert und vom layout her optimiert (dark mode).
This commit is contained in:
68
app/Jobs/AnonymizeAccount.php
Normal file
68
app/Jobs/AnonymizeAccount.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Models\Tenant;
|
||||
use App\Models\User;
|
||||
use App\Services\Compliance\AccountAnonymizer;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class AnonymizeAccount implements ShouldQueue
|
||||
{
|
||||
use Dispatchable;
|
||||
use InteractsWithQueue;
|
||||
use Queueable;
|
||||
use SerializesModels;
|
||||
|
||||
public function __construct(private readonly ?int $userId = null, private readonly ?int $tenantId = null)
|
||||
{
|
||||
if ($this->userId === null && $this->tenantId === null) {
|
||||
throw new \InvalidArgumentException('An anonymization job requires either a user or tenant id.');
|
||||
}
|
||||
|
||||
$this->onQueue('default');
|
||||
}
|
||||
|
||||
public function handle(AccountAnonymizer $anonymizer): void
|
||||
{
|
||||
if ($this->userId) {
|
||||
$user = User::with('tenant')->find($this->userId);
|
||||
|
||||
if (! $user || $user->tenant?->anonymized_at) {
|
||||
return;
|
||||
}
|
||||
|
||||
$anonymizer->anonymize($user);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->tenantId) {
|
||||
$tenant = Tenant::with('user')->find($this->tenantId);
|
||||
|
||||
if (! $tenant || $tenant->anonymized_at) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($tenant->user) {
|
||||
$anonymizer->anonymize($tenant->user);
|
||||
} else {
|
||||
$anonymizer->anonymizeTenantOnly($tenant);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function userId(): ?int
|
||||
{
|
||||
return $this->userId;
|
||||
}
|
||||
|
||||
public function tenantId(): ?int
|
||||
{
|
||||
return $this->tenantId;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user