recht: Meldeverfahren v2 Phasen 1-4 — Re-Sync-Sperre, Anonymisierung, Magic-Link-Intake, Self-Service-Korrektur
Phase 1: sync_locked_at auf press_releases (Importer überspringt gesperrte PMs auch bei --force), LegalRequest um Verifikation/Ausführung erweitert, verschlüsselte Vorher-Snapshots mit Löschfrist (snapshots:purge, täglich). Phase 2: AnonymizationService (Unicode-Wortgrenzen-Schwärzung, Pflicht-Diff, transaktionale Ausführung mit Snapshot, Kontakt-Detach, Bild-Löschung, Sitemap-Invalidierung, Verlauf ohne Klartext-Altwerte); Admin-Queue kann DSGVO-Anfragen anonymisieren oder depublizieren, inkl. Snapshot-Restore. Phase 3: Deflektions-Trichter „PM melden/ändern" (melden/pm) mit Kosten- Tabelle vorab; Magic-Link geht nur an die hinterlegte Pressekontaktadresse (neuer purpose press_release_report), atomare Verifikation, Anliegen-Auswahl erzeugt verifizierte Queue-Anfragen; toter-Kanal-Fallback; Owner-Einstieg. Phase 4: Panel-Abschnitt „Änderung & Korrektur" — Levenshtein-Gate (5 %, Mini-Edit-Ausnahme ≤ 2 Zeichen) stuft klein/groß ein; kleine Korrektur kostenlos sofort live (Snapshot, Sperre, Verlauf, Re-Score), größere als Change-Anfrage (Interim bis 10-€-Checkout, Phase 7). Entwicklungsplan mit Entscheidungen E1-E8 und offenen Punkten in docs/Decision-Update; 41 Pest-Tests (tests/Feature/Legal) grün. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
58c0cc3f23
commit
b4b2e013d6
42 changed files with 3868 additions and 1 deletions
34
database/factories/PressReleaseRedactionSnapshotFactory.php
Normal file
34
database/factories/PressReleaseRedactionSnapshotFactory.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\PressRelease;
|
||||
use App\Models\PressReleaseRedactionSnapshot;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<PressReleaseRedactionSnapshot>
|
||||
*/
|
||||
class PressReleaseRedactionSnapshotFactory extends Factory
|
||||
{
|
||||
protected $model = PressReleaseRedactionSnapshot::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'press_release_id' => PressRelease::factory(),
|
||||
'encrypted_before' => [
|
||||
'title' => fake()->sentence(),
|
||||
'text' => fake()->paragraph(),
|
||||
],
|
||||
'purge_after' => now()->addDays(30)->toDateString(),
|
||||
];
|
||||
}
|
||||
|
||||
public function dueForPurge(): static
|
||||
{
|
||||
return $this->state(fn () => [
|
||||
'purge_after' => now()->subDay()->toDateString(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Re-Sync-Sperre (Meldeverfahren v2, Phase 1): Eine gesetzte Sperre bedeutet,
|
||||
* dass die PM durch das Meldeverfahren mutiert wurde (Korrektur, Anonymisierung,
|
||||
* Depublizierung, Änderung) und kein Schreiben über Legacy-API/Importer mehr
|
||||
* erfolgen darf — sonst holt ein Re-Import den alten Stand/Klarnamen zurück.
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
// Ein kombiniertes ALTER statt zweier Blueprint-Einzelstatements:
|
||||
// Wegen des FULLTEXT-Index kann MySQL hier nicht INSTANT/INPLACE
|
||||
// arbeiten und kopiert die große Tabelle vollständig — mit einem
|
||||
// Statement passiert das nur einmal. SQLite (Tests) kennt kein
|
||||
// Mehrspalten-ADD und läuft über den Blueprint-Zweig.
|
||||
if (DB::connection()->getDriverName() === 'mysql') {
|
||||
DB::statement(
|
||||
'ALTER TABLE `press_releases` '
|
||||
.'ADD COLUMN `sync_locked_at` TIMESTAMP NULL, '
|
||||
.'ADD COLUMN `sync_lock_reason` VARCHAR(255) NULL'
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('press_releases', function (Blueprint $table) {
|
||||
$table->timestamp('sync_locked_at')->nullable();
|
||||
$table->string('sync_lock_reason')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('press_releases', function (Blueprint $table) {
|
||||
$table->dropColumn(['sync_locked_at', 'sync_lock_reason']);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Meldeverfahren v2 (Phase 1): LegalRequest trägt künftig auch die Self-Service-
|
||||
* Spuren (Korrektur/Depublizierung/Änderung) und dokumentiert die Verifikation
|
||||
* (Magic-Link, manuell oder eingeloggter Creator) sowie die Ausführung.
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('legal_requests', function (Blueprint $table) {
|
||||
$table->timestamp('verified_at')->nullable();
|
||||
$table->string('verification_method', 40)->nullable();
|
||||
$table->foreignId('single_purchase_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->timestamp('executed_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('legal_requests', function (Blueprint $table) {
|
||||
$table->dropConstrainedForeignId('single_purchase_id');
|
||||
$table->dropColumn(['verified_at', 'verification_method', 'executed_at']);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Verschlüsselte Vorher-Snapshots für Anonymisierung/Depublizierung
|
||||
* (Meldeverfahren v2, Phase 1): ermöglichen Reversibilität, ohne dass
|
||||
* Alt-Werte im Klartext in Logs oder Payloads weiterleben. Nach Ablauf
|
||||
* von purge_after werden die Zeilen durch snapshots:purge gelöscht
|
||||
* (Löschfrist: config legal.snapshot_retention_days).
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('press_release_redaction_snapshots', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// Snapshot bleibt als Audit-Hülle erhalten, wenn Anfrage/PM gelöscht werden.
|
||||
$table->foreignId('legal_request_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->foreignId('press_release_id')->nullable()->constrained()->nullOnDelete();
|
||||
|
||||
$table->longText('encrypted_before');
|
||||
$table->date('purge_after')->index();
|
||||
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('press_release_redaction_snapshots');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Meldeverfahren v2 (Phase 3): neuer Magic-Link-Zweck press_release_report —
|
||||
* der Verifikations-Link an die hinterlegte Pressekontaktadresse.
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('magic_links', function (Blueprint $table) {
|
||||
$table->enum('purpose', [
|
||||
'login',
|
||||
'press_release_access',
|
||||
'invoice_access',
|
||||
'initial_setup',
|
||||
'press_release_report',
|
||||
])->default('login')->change();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
// Links des entfallenden Zwecks zuerst räumen, sonst scheitert die
|
||||
// Rückverengung des Enums an bestehenden Zeilen.
|
||||
Schema::table('magic_links', function (Blueprint $table) {
|
||||
$table->enum('purpose', [
|
||||
'login',
|
||||
'press_release_access',
|
||||
'invoice_access',
|
||||
'initial_setup',
|
||||
])->default('login')->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue