Task 2's fahrer UPDATE policy only constrains zugewiesen_an in its
WITH CHECK, not the status value itself, so a fahrer could set their
own assigned order straight to 'storniert' even though the spec
reserves cancellation for Disponent/Admin. Live-verified the gap
(UPDATE 1 as fahrer before the fix). Extends Task 4's trigger with a
role-gated check on the 'storniert' target status plus a regression
test (plan(12) -> plan(13)). Also hardens fahrtBeenden/stornieren in
Task 11 to check affected-row counts (matching uebernehmen's existing
pattern) instead of silently "succeeding" when RLS blocks a write for
an unauthorized caller.
The plan's original upsert(onConflict: "auftrag_id,position") for
auftrag_fotos cannot work: PostgREST's onConflict generates an
unqualified ON CONFLICT clause that can't target Task 3's partial
unique index (position <> 'schaden'), and even a working ON CONFLICT
would hit RLS since only admin has UPDATE on auftrag_fotos. Switched
to plain insert with checked errors on both write paths, consistent
with the spec's "Loeschen/Ersetzen nur durch Admin" rule.
The fahrer UPDATE policy on auftraege, the fahrer INSERT policy on
auftrag_fotos, and the storage upload policy all lacked an explicit
public.user_role() = 'fahrer' predicate, so any authenticated role
(including the default readonly signup role) could exploit the
status='offen' clause to self-assign open orders. Also adds identity
binding (erstellt_von/uploaded_by = auth.uid()) on inserts, and a
column-lockdown check in Task 4's trigger so a fahrer can't smuggle
changes to abholort_id/zielort_id/fahrzeug_id/erstellt_von/
vorgaenger_auftrag_id into an otherwise-legitimate update.
11 tasks covering the orte/fahrzeuge lookup pools, the auftraege
core table with RLS and a DB-enforced status transition trigger,
photo storage with RLS, and the driver/dispatcher-facing pages.