archive: Beweisarchiv — verschlüsselte Einträge, Legal Hold, Purge mit Tombstone, Restore-Abgleich, Auslöser und Admin-Seite (Bildkennzeichnung Block F)

- archive_entries (append-only) + archive_access_log; Disk archive außerhalb des Web-Roots; eigener ARCHIVE_KEY (archive:key), AES-256-CBC, SHA-256 am Eintrag
- EvidenceArchive: record/open/manifest/export (signiertes ZIP), setLegalHold/releaseLegalHold (Frist läuft neu), purgeDue, exportTombstones, reconcileAfterRestore
- PressReleaseArchiver: image_removed (Original, Snapshot, Bestätigungen), pm_depublished (letzter veröffentlichter Stand), gdpr_change (Anonymisierung, Korrekturen), label_corrected
- Hooks in Remover, depublish/archive/changeStatusFromAdmin/deleteFromAdmin, AnonymizationService, CorrectionService, ImageCorrectionService
- Scheduler archive:purge 03:20 und archive:export-tombstones 03:30; archive:reconcile-after-restore im Runbook
- Admin ▸ Management ▸ Beweisarchiv (Liste, Legal Hold mit Pflichtvermerk, Öffnen/Export nur mit Zweck)
- Scope-Wächter: neue Befehle nutzen withoutGlobalScope(PortalScope::class)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-09-22 10:04:21 +00:00
parent da167b713b
commit b5b70416f2
30 changed files with 1746 additions and 6 deletions

View file

@ -0,0 +1,13 @@
<x-layouts.app :title="__('Zweck des Zugriffs')">
<div class="max-w-lg space-y-4">
<flux:heading size="xl">{{ __('Zweck des Zugriffs') }}</flux:heading>
<flux:text>{{ __('Archiveintrag #:id (:event). Jeder Zugriff auf das Beweisarchiv wird mit Zweck protokolliert.', ['id' => $entry->id, 'event' => $entry->event->label()]) }}</flux:text>
<form method="get" action="{{ route($action === 'export' ? 'admin.archive.export' : 'admin.archive.download', ['entry' => $entry->id]) }}" class="space-y-3">
<flux:input name="purpose" :label="__('Zweck (Pflicht)')" :placeholder="__('z. B. Abmahnung Az. 12/2026 prüfen')" required autofocus />
<div class="flex gap-2">
<flux:button type="submit" variant="primary">{{ $action === 'export' ? __('Export herunterladen') : __('Payload öffnen') }}</flux:button>
<flux:button variant="filled" href="{{ route('admin.archive.index') }}">{{ __('Abbrechen') }}</flux:button>
</div>
</form>
</div>
</x-layouts.app>

View file

@ -142,6 +142,10 @@
:current="request()->routeIs('admin.reports.activity')" wire:navigate>
{{ __('Verlauf') }}
</flux:navlist.item>
<flux:navlist.item icon="archive-box" :href="route('admin.archive.index')"
:current="request()->routeIs('admin.archive.*')" wire:navigate>
{{ __('Beweisarchiv') }}
</flux:navlist.item>
{{-- Kontakt: Anliegen aus dem Kontakt-Widget (Widget + Hub-Formular) --}}
<flux:navlist.item icon="chat-bubble-left-right" :href="route('admin.contact-messages.index')"
:current="request()->routeIs('admin.contact-messages.*')"

View file

@ -0,0 +1,176 @@
<?php
use App\Enums\ArchiveEvent;
use App\Models\ArchiveEntry;
use App\Services\Archive\EvidenceArchive;
use Flux\Flux;
use Livewire\Attributes\Layout;
use Livewire\Attributes\Title;
use Livewire\Attributes\Url;
use Livewire\Volt\Component;
use Livewire\WithPagination;
/**
* Admin ▸ Management ▸ Beweisarchiv (Bildkennzeichnung Block F.2).
*
* Liste der Einträge, Legal-Hold-Schalter mit Pflichtvermerk, Öffnen und
* Export nur mit Zweck (Zugriffsprotokoll). Inhalte werden hier nie
* angezeigt — nur Kennzahlen; der Payload kommt als Download.
*/
new #[Layout('components.layouts.app'), Title('Beweisarchiv')] class extends Component
{
use WithPagination;
#[Url]
public string $event = '';
#[Url]
public string $subject = '';
public ?int $holdEntryId = null;
public string $holdNote = '';
public function openHold(int $entryId): void
{
$this->holdEntryId = $entryId;
$this->holdNote = '';
$this->resetErrorBag();
}
public function toggleHold(EvidenceArchive $archive): void
{
$entry = ArchiveEntry::query()->findOrFail((int) $this->holdEntryId);
$this->validate(
['holdNote' => ['required', 'string', 'min:5', 'max:1000']],
['holdNote.required' => __('Bitte begründen Sie das Setzen bzw. Aufheben (Pflichtvermerk).')],
);
$entry->legal_hold
? $archive->releaseLegalHold($entry, auth()->user(), $this->holdNote)
: $archive->setLegalHold($entry, auth()->user(), $this->holdNote);
$this->holdEntryId = null;
$this->holdNote = '';
Flux::toast(text: $entry->fresh()->legal_hold ? __('Legal Hold gesetzt.') : __('Legal Hold aufgehoben, Frist läuft neu.'), variant: 'success');
}
public function with(): array
{
$query = ArchiveEntry::query()->orderByDesc('id');
if ($this->event !== '' && ArchiveEvent::tryFrom($this->event) !== null) {
$query->where('event', $this->event);
}
if ($this->subject !== '') {
$query->where(function ($q): void {
$q->where('press_release_id', (int) $this->subject)->orWhere('subject_id', (int) $this->subject);
});
}
return [
'entries' => $query->paginate(50),
'events' => ArchiveEvent::cases(),
'configured' => app(EvidenceArchive::class)->isConfigured(),
'holdEntry' => $this->holdEntryId ? ArchiveEntry::query()->find($this->holdEntryId) : null,
];
}
}; ?>
<div class="space-y-6">
<div class="flex flex-wrap items-end justify-between gap-4">
<div>
<flux:heading size="xl">{{ __('Beweisarchiv') }}</flux:heading>
<flux:subheading>{{ __('Verschlüsselte Datensätze zu entfernten Veröffentlichungen. Drei Jahre zum Jahresende, Legal Hold hat Vorrang. Jeder Zugriff wird mit Zweck protokolliert.') }}</flux:subheading>
</div>
<div class="flex gap-2">
<flux:select wire:model.live="event" size="sm">
<flux:select.option value="">{{ __('Alle Ereignisse') }}</flux:select.option>
@foreach ($events as $eventOption)
<flux:select.option :value="$eventOption->value">{{ $eventOption->label() }}</flux:select.option>
@endforeach
</flux:select>
<flux:input wire:model.live.debounce.400ms="subject" size="sm" :placeholder="__('PM- oder Bild-ID')" class="w-40" />
</div>
</div>
@unless ($configured)
<flux:callout variant="danger" icon="exclamation-triangle">
{{ __('ARCHIVE_KEY ist nicht gesetzt: Es wird nichts archiviert und nichts kann geöffnet werden. Schlüssel mit „php artisan archive:key“ erzeugen, in der Umgebung setzen und getrennt sichern.') }}
</flux:callout>
@endunless
<flux:card>
<table class="w-full text-[13px]">
<thead>
<tr class="text-left text-zinc-500">
<th class="py-2 pr-3 font-medium">#</th>
<th class="py-2 pr-3 font-medium">{{ __('Ereignis') }}</th>
<th class="py-2 pr-3 font-medium">{{ __('Betrifft') }}</th>
<th class="py-2 pr-3 font-medium">{{ __('Grund') }}</th>
<th class="py-2 pr-3 font-medium">{{ __('Angelegt') }}</th>
<th class="py-2 pr-3 font-medium">{{ __('Frist bis') }}</th>
<th class="py-2 pr-3 font-medium">{{ __('Status') }}</th>
<th class="py-2 font-medium"></th>
</tr>
</thead>
<tbody class="divide-y divide-zinc-200 dark:divide-zinc-700">
@forelse ($entries as $entry)
<tr wire:key="archive-{{ $entry->id }}">
<td class="py-2 pr-3 font-mono text-zinc-500">{{ $entry->id }}</td>
<td class="py-2 pr-3">{{ $entry->event->label() }}</td>
<td class="py-2 pr-3 text-zinc-600 dark:text-zinc-300">
{{ class_basename($entry->subject_type) }} #{{ $entry->subject_id }}
@if ($entry->press_release_id)
· <a class="underline underline-offset-2" href="{{ route('admin.press-releases.show', ['id' => $entry->press_release_id]) }}" wire:navigate>PM #{{ $entry->press_release_id }}</a>
@endif
</td>
<td class="py-2 pr-3">{{ $entry->reason_category->label() }}</td>
<td class="py-2 pr-3 whitespace-nowrap">{{ $entry->created_at?->format('d.m.Y H:i') }}</td>
<td class="py-2 pr-3 whitespace-nowrap">{{ $entry->retain_until->format('d.m.Y') }}</td>
<td class="py-2 pr-3">
@if ($entry->isTombstoned())
<flux:badge size="sm" color="zinc">{{ __('gelöscht') }}</flux:badge>
@elseif ($entry->legal_hold)
<flux:badge size="sm" color="red">Legal Hold</flux:badge>
@else
<flux:badge size="sm" color="green">{{ __('aufbewahrt') }}</flux:badge>
@endif
</td>
<td class="py-2 text-right whitespace-nowrap">
@unless ($entry->isTombstoned())
<flux:button size="xs" variant="ghost" wire:click="openHold({{ $entry->id }})">
{{ $entry->legal_hold ? __('Hold aufheben') : __('Legal Hold') }}
</flux:button>
<flux:button size="xs" variant="ghost" href="{{ route('admin.archive.download', ['entry' => $entry->id]) }}">{{ __('Öffnen') }}</flux:button>
<flux:button size="xs" variant="ghost" href="{{ route('admin.archive.export', ['entry' => $entry->id]) }}">{{ __('Export') }}</flux:button>
@endunless
</td>
</tr>
@empty
<tr><td colspan="8" class="py-6 text-center text-zinc-500">{{ __('Noch keine Archiveinträge.') }}</td></tr>
@endforelse
</tbody>
</table>
<div class="mt-4">{{ $entries->links() }}</div>
</flux:card>
@if ($holdEntry)
<flux:card data-hold-form>
<flux:heading size="md">{{ $holdEntry->legal_hold ? __('Legal Hold aufheben (Eintrag #:id)', ['id' => $holdEntry->id]) : __('Legal Hold setzen (Eintrag #:id)', ['id' => $holdEntry->id]) }}</flux:heading>
@if ($holdEntry->legal_hold_note)
<flux:text class="mt-1 text-sm text-zinc-500">{{ __('Letzter Vermerk: :note', ['note' => $holdEntry->legal_hold_note]) }}</flux:text>
@endif
<div class="mt-3 space-y-3">
<flux:textarea wire:model="holdNote" :label="__('Pflichtvermerk (Streit, Regress, Aktenzeichen)')" rows="2" />
<div class="flex gap-2">
<flux:button variant="primary" wire:click="toggleHold">{{ $holdEntry->legal_hold ? __('Aufheben') : __('Setzen') }}</flux:button>
<flux:button variant="filled" wire:click="$set('holdEntryId', null)">{{ __('Abbrechen') }}</flux:button>
</div>
</div>
</flux:card>
@endif
</div>