fix: refuse private/unpublished menu links, write only changed menu items

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
2026-09-26 00:20:34 +02:00
co-authored by Claude Opus 5.5
parent f80cfb9e44
commit a2e9dabb17
6 changed files with 355 additions and 67 deletions
@@ -66,16 +66,18 @@ final class MenuOperations
return 'Objekt erwartet.';
}
$op = $operation['op'] ?? '';
$parentId = (int) ($operation['parent_id'] ?? 0);
$parentKey = $parentId > 0 ? 'id:' . $parentId : self::ROOT;
if (! isset($children[$parentKey])) {
// parent_id only matters where something is placed; remove ignores it.
if (in_array($op, ['add', 'move'], true) && ! isset($children[$parentKey])) {
return 'parent_id ist kein Eintrag dieses Menüs.';
}
$position = isset($operation['position']) ? (int) $operation['position'] : null;
$key = 'id:' . (int) ($operation['id'] ?? 0);
switch ($operation['op'] ?? '') {
switch ($op) {
case 'add':
if (! is_array($operation['item'] ?? null)) {
return 'item fehlt.';