images: Datenmodell, Textarchiv, Herkunftsprüfung und gemeinsamer Uploader für Formular v2 (Bildkennzeichnung Block A)
- press_release_images: Kundenangabe/Portalkennzeichnung getrennt, Herkunftsbefund, Beweisoriginal, Snapshot-Pfade, published_ever_at, rules_version, Fokus/Letterbox; Bestand unangetastet - legal_texts (insert-only) mit img-confirm-v1 (alter Wortlaut), v2 (AGB 0.6), v3 (AGB 0.7, noch ohne Datum); image-rights:backfill-confirmations - image_rights_confirmations polymorph, insert-only, IP als versionierter HMAC; Löschung nur für nie veröffentlichte Uploads - ImageProvenanceInspector (Imagick/exif): IPTC, XMP, EXIF; algorithmicallyEnhanced nur Vermerk; unlesbare Datei = error - PressReleaseImageUploader: Original vor Derivaten, Hash-Bindung, Titelbild-Regel unter Sperre, Dateien bei Fehlern zurückgerollt; Admin-Upload ohne Bestätigung - ImageService: kein Rückfall auf die Quelldatei, og-Variante, Fokuspunkt und no_crop Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
b624f80d7f
commit
e9bdff3ad3
36 changed files with 2631 additions and 30 deletions
128
app/Models/ImageRightsConfirmation.php
Normal file
128
app/Models/ImageRightsConfirmation.php
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\ConfirmationChannel;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
|
||||
/**
|
||||
* Protokollierte Rechtebestätigung zu einem Bild (Bildkennzeichnung A.2).
|
||||
*
|
||||
* Insert-only: `ImageRightsConfirmationObserver` wirft bei Update und
|
||||
* Delete. Die einzige zulässige Löschung ist die Sofortlöschung eines nie
|
||||
* veröffentlichten Uploads (Decision-Update E4) über purgeForUnpublished().
|
||||
*
|
||||
* `user_id` ist der Kontoinhaber und damit der Vertragspartner (E1);
|
||||
* `company_id` ist nur die Zuordnung zum Firmenprofil. `text_snapshot` hält
|
||||
* den gerenderten Wortlaut mit aufgelöster AGB-Fassung fest, damit die
|
||||
* Bestätigung auch dann rekonstruierbar bleibt, wenn `legal_texts` und
|
||||
* `legal_documents` weiterwachsen.
|
||||
*/
|
||||
class ImageRightsConfirmation extends Model
|
||||
{
|
||||
public const UPDATED_AT = null;
|
||||
|
||||
/**
|
||||
* Vom Observer geprüfter Freischein für die Sofortlöschung nie
|
||||
* veröffentlichter Uploads (E.3). Nie von außen setzen.
|
||||
*/
|
||||
public bool $purgingUnpublished = false;
|
||||
|
||||
protected $fillable = [
|
||||
'subject_type',
|
||||
'subject_id',
|
||||
'press_release_id',
|
||||
'company_id',
|
||||
'user_id',
|
||||
'personal_access_token_id',
|
||||
'channel',
|
||||
'legal_text_id',
|
||||
'legal_text_key',
|
||||
'text_snapshot',
|
||||
'agb_version',
|
||||
'locale',
|
||||
'file_sha256',
|
||||
'declaration_snapshot',
|
||||
'ip_hmac',
|
||||
'user_agent',
|
||||
'confirmed_at',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'channel' => ConfirmationChannel::class,
|
||||
'declaration_snapshot' => 'array',
|
||||
'confirmed_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Pseudonymisierte IP-Ableitung: HMAC mit eigenem Schlüssel und
|
||||
* Versionspräfix (Decision-Update 3.7). Kein reiner Hash — ohne den
|
||||
* Schlüssel lässt sich keine Adresse zuordnen.
|
||||
*/
|
||||
public static function hashIp(?string $ip): ?string
|
||||
{
|
||||
if (blank($ip)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$key = (string) config('images.confirmation_ip_key');
|
||||
$version = (string) config('images.confirmation_ip_hash_version', 'v1');
|
||||
|
||||
return $version.':'.hash_hmac('sha256', $ip, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sofortlöschung eines nie veröffentlichten Uploads (E.3). Nur hier
|
||||
* darf eine Bestätigung verschwinden — der Observer prüft das Flag.
|
||||
*/
|
||||
public function purgeForUnpublished(): void
|
||||
{
|
||||
$this->purgingUnpublished = true;
|
||||
$this->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphTo<Model, $this>
|
||||
*/
|
||||
public function subject(): MorphTo
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<PressRelease, $this>
|
||||
*/
|
||||
public function pressRelease(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PressRelease::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<Company, $this>
|
||||
*/
|
||||
public function company(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Company::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<User, $this>
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<LegalText, $this>
|
||||
*/
|
||||
public function legalText(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(LegalText::class);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue