LuminaWebsite/raid_delete_action.php
Maaxxs b96bbd1780 Consilium: own Discord server - its roles decide who sees the Consilium; rights for Consilium raids and entries
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>
2026-09-28 02:55:59 +02:00

45 lines
1.4 KiB
PHP

<?php
require_once __DIR__ . '/includes/bootstrap.php';
require_once __DIR__ . '/includes/raids_api.php';
require_login();
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
redirect('/raids.php');
}
verify_csrf();
$status = (string) ($_POST['status'] ?? 'archived');
if (!in_array($status, RAID_STATUSES, true)) {
$status = 'archived';
}
$redirectTo = '/raids.php?status=' . urlencode($status);
$raidId = (int) ($_POST['raid_id'] ?? 0);
if ($raidId <= 0) {
redirect($redirectTo);
}
// Loeschen 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 {
$raidLabel = admin_log_raid($raidId);
try {
$raidBefore = fetch_raid_by_id($raidId); // nur fuers Audit-Log
} catch (Throwable $e) {
$raidBefore = null;
}
delete_raid_permanently($raidId);
admin_log('🗑️ Raid endgültig gelöscht', [
'Raid' => $raidLabel,
'Anmeldungen' => admin_log_raid_signups($raidBefore),
], 'danger');
set_flash('success', 'Raid wurde endgültig gelöscht.');
} catch (Throwable $e) {
set_flash('error', 'Löschen fehlgeschlagen: ' . $e->getMessage());
}
redirect($redirectTo);