Drag&drop moves and the underlying raid_move_action.php had no idea about locked_groups, so an admin could still drag a member into a group that was explicitly locked. Locked drop zones are now flagged in the markup, the frontend refuses the drag/drop, and the endpoint rejects the move server-side as well. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
32 lines
1 KiB
PHP
32 lines
1 KiB
PHP
<?php
|
|
require_once __DIR__ . '/includes/bootstrap.php';
|
|
require_once __DIR__ . '/includes/raids_api.php';
|
|
require_permission('raids.manage');
|
|
|
|
$input = read_json_body();
|
|
verify_csrf_token($input['csrf_token'] ?? '');
|
|
|
|
$raidId = (int) ($input['raid_id'] ?? 0);
|
|
$discordId = (int) ($input['user_id'] ?? 0);
|
|
$group = $input['group'] ?? null;
|
|
|
|
if ($raidId <= 0 || $discordId <= 0 || !is_numeric($group) || (int) $group < 0) {
|
|
json_response(false, 'Ungültige Anfrage.');
|
|
}
|
|
|
|
$group = (int) $group;
|
|
|
|
try {
|
|
if ($group > 0) {
|
|
$raid = fetch_raid_by_id($raidId);
|
|
$lockedGroups = is_array($raid['locked_groups'] ?? null) ? array_map('intval', $raid['locked_groups']) : [];
|
|
if (in_array($group, $lockedGroups, true)) {
|
|
json_response(false, 'Diese Gruppe ist gesperrt.');
|
|
}
|
|
}
|
|
|
|
move_signup($raidId, $discordId, $group);
|
|
json_response(true, 'Spieler wurde verschoben.');
|
|
} catch (Throwable $e) {
|
|
json_response(false, 'Verschieben fehlgeschlagen: ' . $e->getMessage());
|
|
}
|