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:
@@ -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.';
|
||||
|
||||
Reference in New Issue
Block a user