Lasse Bilder im Text den Rechten des Textes folgen, gib Bild- und PDF-Adressen ohne Ablauf aus und belege die Abnahme
- Bilder im Text folgen dem Recht am Text; eine eigene Fähigkeit für Bilder ist nicht nötig (ADR-51, fachliche Entscheidung zur Bestätigung). - Bildadresse und PDF-Adresse des Dokuments laufen nicht ab; jeder Abruf entscheidet neu. - Die Fähigkeit text:laden ist im Rechteprofil wählbar. - Dokumentkapitel in der Medienansicht verweisen auf ihr Dokument; die Pille nennt jetzt auch Dokumentkapitel (MedienFilterDialogTest bewusst angepasst). - Abnahmeprotokoll mit Bildern unter docs/ux/verwaltung/abnahme/dokumente. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8a44c5886b
commit
81037b9868
56 files changed
+222
-95
No files matched your search
@@ -5,6 +5,7 @@
|
||||
use App\Domain\Catalog\ArticleRelease;
|
||||
use App\Domain\Catalog\CompositionKind;
|
||||
use App\Domain\Catalog\CompositionVersion;
|
||||
use App\Domain\Catalog\ContentElementVersion;
|
||||
use App\Domain\Catalog\DocumentGuide;
|
||||
use App\Domain\Catalog\DocumentPdf;
|
||||
use App\Domain\Catalog\EmbeddedImages;
|
||||
@@ -12,7 +13,6 @@
|
||||
use App\Domain\Catalog\LicenseArticle;
|
||||
use App\Domain\Media\DeliveryLog;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\SignedLink;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
@@ -41,24 +41,18 @@ public function show(Request $request, LicenseArticle $article, ArticleRelease $
|
||||
'guide' => $guide,
|
||||
'reader' => $request->user()->name,
|
||||
'copy' => $shown ? $copy : null,
|
||||
'pdfUrl' => app(DocumentGuide::class)->pdfAllowed($guide) ? SignedLink::temporary('member.document.pdf', now()->addMinutes(10), [
|
||||
'article' => $article->id,
|
||||
'release' => $release->id,
|
||||
'path' => $path,
|
||||
'reader' => $request->user()->id,
|
||||
]) : null,
|
||||
// Ohne Ablauf der Adresse: Die Seite bleibt lange offen; bei jedem Abruf entscheidet `DecideAccess` neu.
|
||||
'pdfUrl' => app(DocumentGuide::class)->pdfAllowed($guide) ? route('member.document.pdf', ['article' => $article, 'release' => $release, 'path' => $path]) : null,
|
||||
]);
|
||||
}
|
||||
|
||||
public function pdf(Request $request, LicenseArticle $article, ArticleRelease $release, string $path): Response
|
||||
{
|
||||
abort_unless((int) $request->query('reader') === $request->user()->id, 403);
|
||||
|
||||
[$guide, $located] = $this->load($request, $article, $release, $path);
|
||||
abort_unless(app(DocumentGuide::class)->pdfAllowed($guide), 403, 'Für dieses PDF fehlt die Berechtigung für ein Kapitel.');
|
||||
|
||||
$copy = DeliveryLog::newCopyId();
|
||||
$images = app(EmbeddedImages::class)->forPdf($request->user(), $article, $release);
|
||||
$images = app(EmbeddedImages::class)->forPdf($request->user(), $article, $release, array_map(fn (array $chapter): ContentElementVersion => $chapter['version'], $guide['chapters']));
|
||||
$content = app(DocumentPdf::class)->render($guide, $request->user()->name, $copy, $images);
|
||||
$checksum = hash('sha256', $content);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
use App\Domain\Catalog\ArticleRelease;
|
||||
use App\Domain\Catalog\CompositionVersion;
|
||||
use App\Domain\Catalog\ContentElementVersion;
|
||||
use App\Domain\Catalog\EmbeddedImages;
|
||||
use App\Domain\Catalog\ExerciseGuide;
|
||||
use App\Domain\Catalog\ExercisePdf;
|
||||
@@ -77,7 +78,7 @@ public function pdf(Request $request, LicenseArticle $article, ArticleRelease $r
|
||||
|
||||
$copy = DeliveryLog::newCopyId();
|
||||
$variant = collect($guide['variants'])->firstWhere('key', $guide['chosen']);
|
||||
$images = app(EmbeddedImages::class)->forPdf($request->user(), $article, $release);
|
||||
$images = app(EmbeddedImages::class)->forPdf($request->user(), $article, $release, array_values(array_map(fn (array $section): ContentElementVersion => $section['version'], array_filter($sections, fn (array $section): bool => $section['class'] === 'text'))));
|
||||
$content = $pdf->render(
|
||||
$guide,
|
||||
$sections,
|
||||
|
||||
@@ -241,6 +241,7 @@ public function show(Request $request, LicenseArticle $article): View
|
||||
'class' => $class,
|
||||
'content' => $content,
|
||||
'version' => $version,
|
||||
'images' => $class === 'text' ? app(EmbeddedImages::class)->forView($request->user(), $article, $release, $version) : null,
|
||||
'role' => $content->role,
|
||||
'action' => $action,
|
||||
'allowed' => $decision->allowed,
|
||||
@@ -279,7 +280,6 @@ public function show(Request $request, LicenseArticle $article): View
|
||||
'entries' => $entries,
|
||||
'title' => app(CourseOutline::class)->title($article),
|
||||
'kind' => app(CourseOutline::class)->kindLabel($article),
|
||||
'images' => $release === null ? null : app(EmbeddedImages::class)->forView($request->user(), $article, $release),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ public function media(
|
||||
'article' => $article,
|
||||
'version' => $version,
|
||||
'license' => $decision->grant->rights_snapshot['purpose'] ?? null,
|
||||
'images' => app(EmbeddedImages::class)->forView($request->user(), $article, $release),
|
||||
'images' => app(EmbeddedImages::class)->forView($request->user(), $article, $release, $version),
|
||||
'reader' => $request->user()->name,
|
||||
'copy' => $delivery->copy_id,
|
||||
]);
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Member;
|
||||
|
||||
use App\Domain\Catalog\ArticleRelease;
|
||||
use App\Domain\Catalog\ContentElementVersion;
|
||||
use App\Domain\Catalog\EmbeddedImages;
|
||||
use App\Domain\Catalog\ExerciseGuide;
|
||||
use App\Domain\Catalog\LicenseArticle;
|
||||
use App\Domain\Media\DeliveryLog;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\LibraryCatalog;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
|
||||
/**
|
||||
* Ein Bild im Text eines erworbenen Stands (ADR-51). Die Adresse läuft nicht ab, weil eine Seite lange offen bleibt; dafür
|
||||
* entscheidet jeder Abruf neu: Konto, Stand, Text, Recht am Text, Zugehörigkeit des Bildes zum Text und zum Stand und die
|
||||
* Sperre der Bildfassung. Eine Datei liegt nie unter einem öffentlichen Pfad.
|
||||
*/
|
||||
class StandImageController extends Controller
|
||||
{
|
||||
public function __invoke(Request $request, LicenseArticle $article, ArticleRelease $release, ContentElementVersion $text, ContentElementVersion $version): StreamedResponse
|
||||
{
|
||||
abort_unless(app(ExerciseGuide::class)->mayOpen($request->user(), $article, $release), 403);
|
||||
|
||||
$served = app(EmbeddedImages::class)->serve($request->user(), $article, $release, $text, $version->id);
|
||||
abort_if($served === null, 403);
|
||||
|
||||
$file = EmbeddedImages::file($served['version']);
|
||||
abort_if($file === null, 404);
|
||||
|
||||
$disk = Storage::disk('media_derived');
|
||||
$delivery = app(DeliveryLog::class)->write($served['grant'], $article, $release, $served['version'], 'ansehen', 'bestand', hash_file('sha256', $disk->path($file)) ?: null, 'k0');
|
||||
$title = app(LibraryCatalog::class)->text($served['version']->element)['title'];
|
||||
$name = ($title !== '' ? preg_replace('/[\x00-\x1F\x7F\/\\\\:*?"<>|]+/u', ' ', $title) : 'bild').'.'.strtolower(pathinfo($file, PATHINFO_EXTENSION));
|
||||
|
||||
return $disk->response($file, trim((string) $name), ['X-License-Copy' => $delivery->copy_id, 'Cache-Control' => 'private, max-age=300'], 'inline');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user