Asked for: the alliances move to their own Discord server with the roles Force Commander, Legion Lead, Legion Officer and Legionär. Decided: everyone with a role there sees the Consilium (our members too), no role per legion (assignment stays on the website), new accounts are approved by our admins, rights per role as planned, a permission for Consilium calendar entries that is assigned later. Server ID 1553882046793777283. - Two Discord servers: settings.consilium_guild_id (seeded, Verwaltung -> Discord-Bot with a check whether the bot is there); a group's role lies on one of them (roles.discord_guild_id, NULL = legion, schema 71). Login and the periodic sync read both memberships (discord_fetch_memberships/discord_apply_memberships) and sync groups per server; name, avatar, joined date and classes come from the legion server, for allies from the Consilium server. - Leaving: whoever leaves a server loses its groups; an account is deactivated only when it is on neither (discord_member_left_guild; bot_api.php takes in_guilds from the bot, the sync checks all servers, older bot versions cannot deactivate Consilium members). Logout text no longer names a server. - Group form lists the roles of both servers, the group list marks Consilium roles; Consilium-Raids channel is chosen from the Consilium server's channels. - Rights per area: consilium.raids / consilium.raids.manage for Consilium raids (create, manage, restore, delete), raids.create / raids.manage only for legion raids (raid_area_can_create, raid_area_can_manage_all, raid_can_manage asks the raid's area). consilium.calendar: only with it Consilium calendar entries (allies without it cannot add entries; legion members with it get "Für wen?" with legion/Consilium). - Consilium member list: everyone with a role on the Consilium server - our legion as its own section, allied legions, without legion - with the Consilium ranks as tags; legion list and profiles leave the Consilium groups out for those who do not see the Consilium. Allies pick their class in the profile. - Consilium admin page: setup checklist for the new structure with the groups of the Consilium server and their rights (setup only for roles.manage). Privacy page, README. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
44 lines
1.5 KiB
PHP
44 lines
1.5 KiB
PHP
<?php
|
|
require_once __DIR__ . '/includes/bootstrap.php';
|
|
require_once __DIR__ . '/includes/raids_api.php';
|
|
require_once __DIR__ . '/includes/raid_attendance.php';
|
|
require_login();
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
|
redirect('/raids.php');
|
|
}
|
|
verify_csrf();
|
|
|
|
$status = (string) ($_POST['status'] ?? 'active');
|
|
if (!in_array($status, RAID_STATUSES, true)) {
|
|
$status = 'active';
|
|
}
|
|
$redirectTo = '/raids.php?status=' . urlencode($status);
|
|
|
|
$raidId = (int) ($_POST['raid_id'] ?? 0);
|
|
if ($raidId <= 0) {
|
|
redirect($redirectTo);
|
|
}
|
|
// Wiederherstellen darf, wer alle Raids des Bereichs verwaltet: Legion raids.manage, Consilium consilium.raids.manage
|
|
$area = raid_area_of($raidId);
|
|
if ($area === null || !raid_area_can_manage_all($area)) {
|
|
show_not_found();
|
|
}
|
|
$redirectTo .= $area === 'consilium' && raid_area_visible('legion') ? '&bereich=consilium' : '';
|
|
|
|
try {
|
|
$newRaidId = restore_raid($raidId);
|
|
// Neu gepostet (neue raid_id): Einstellungen, Anwesenheit und Vergaben ziehen mit um.
|
|
raid_rename_id($raidId, $newRaidId);
|
|
admin_log('♻️ Raid wiederhergestellt', [
|
|
'Raid' => admin_log_raid($newRaidId),
|
|
'Hinweis' => $newRaidId !== $raidId ? 'Discord-Nachricht wurde neu gepostet' : '',
|
|
], 'success');
|
|
set_flash('success', $newRaidId !== $raidId
|
|
? 'Raid wurde wiederhergestellt und im Discord neu gepostet.'
|
|
: 'Raid wurde wiederhergestellt.');
|
|
} catch (Throwable $e) {
|
|
set_flash('error', 'Wiederherstellen fehlgeschlagen: ' . $e->getMessage());
|
|
}
|
|
|
|
redirect($redirectTo);
|