LuminaWebsite/admin/roles.php
Maaxxs c4f94bf84a Member feedback: raid input checks and fixed raid points, premades in the raid form, live raid page, Lumina-style dialogs, leadership calendar entries, class-based weapon picker, map and tactics fixes
- Raids: "Max. Spieler" only whole numbers up to groups x 5 (max. 10 groups / 50), gearscore only a number; fixed +1 Lumipunkt per participation, other values only with the new raids.points permission; pick an existing premade per group when creating a raid; unchanged legacy values no longer block editing
- Raid page updates itself every 15 s while visible (raids_live.php, cards rendered by includes/raid_card.php), open editors and confirm dialogs are kept
- Restore takes the new raid_id from the bot (archived messages are now deleted in Discord) and moves settings, attendance and awards; website signups send the server display name
- Premades: dissolve by leadership needs a reason, lead gets DMs on join/assign/decline/remove (source/actor_id sent to the bot), transfer picker skips players who already lead a group, website accept keeps the one-group rule, no commas in names
- Site-wide Lumina dialog (assets/js/confirm-dialog.js) replaces confirm/prompt/alert via data-confirm; error flashes are a dialog you confirm with OK
- Calendar: audience per entry (all / leadership takes part / internal) with the new calendar.leadership permission; day cells list all entries and scroll
- Gear planner: main-hand picker filtered by the set's class, mismatches marked, "keine Klasse" option, link to an external skill/Daevanion plan per set
- Map: correct kisk icons (Elyos on Verteron/Abyss, Altgard fixed), per-map max zoom and bounded panning, German texts, data source note
- Tactics: toolbar as a uniform grid, whole-tactic copy, automatic versions with restore and a 90-day trash, official tactics protected
- Global thin gold scrollbars, readable hover colours, "Sedes Luminis" spelling, patch notes and README, schema version 34

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 16:12:18 +02:00

97 lines
4.2 KiB
PHP

<?php
require_once __DIR__ . '/../includes/bootstrap.php';
require_once __DIR__ . '/../includes/events_api.php';
require_permission('roles.manage');
$roles = db()->query(
'SELECT r.id, r.name, r.display_name, r.description, r.is_system, r.roster_order, r.discord_role_id,
COUNT(DISTINCT ur.user_id) AS user_count,
COUNT(DISTINCT rp.permission_id) AS permission_count
FROM roles r
LEFT JOIN user_roles ur ON ur.role_id = r.id
LEFT JOIN role_permissions rp ON rp.role_id = r.id
GROUP BY r.id
ORDER BY r.name'
)->fetchAll();
// Namen der Discord-Rollen fuer die Anzeige - ohne Bot-API bleibt es bei der Rollen-ID.
$guildRoles = [];
try {
foreach (fetch_guild_roles() as $guildRole) {
$guildRoles[(string) ($guildRole['role_id'] ?? '')] = (string) ($guildRole['name'] ?? '');
}
} catch (Throwable $e) {
$guildRoles = [];
}
$pageTitle = 'Berechtigungsgruppen';
// Die Tabelle hat viele Spalten - volle Breite statt der schmalen Inhaltsspalte.
$containerWide = true;
include __DIR__ . '/../includes/header.php';
?>
<div class="panel">
<h1>Berechtigungsgruppen</h1>
<p class="text-muted">
Rollen fassen mehrere Berechtigungen zusammen. Jeder Benutzer kann eine oder mehrere Gruppen
haben, die Rechte addieren sich. Gruppen mit Discord-Rolle werden automatisch vergeben und
entzogen - wer mehrere dieser Rollen hat, bekommt alle zugehörigen Gruppen.
</p>
<p><a class="button" href="/admin/role_form.php">Neue Gruppe anlegen</a></p>
<div class="table-scroll">
<table class="table-actions">
<thead>
<tr>
<th>Name</th>
<th>Anzeigename</th>
<th>Beschreibung</th>
<th>Discord-Rolle</th>
<th>Mitgliederliste</th>
<th>Mitglieder</th>
<th>Berechtigungen</th>
<th>Aktionen</th>
</tr>
</thead>
<tbody>
<?php foreach ($roles as $r): ?>
<tr>
<td><?= e($r['name']) ?> <?php if ($r['is_system']): ?><span class="badge">System</span><?php endif; ?></td>
<td><?= $r['display_name'] !== '' ? e($r['display_name']) : '<span class="text-muted">—</span>' ?></td>
<td><?= e($r['description']) ?></td>
<td>
<?php if ($r['discord_role_id'] !== null): ?>
<?php $roleName = $guildRoles[(string) $r['discord_role_id']] ?? ''; ?>
<span class="discord-inline"><?= discord_logo(14) ?> <?= $roleName !== '' ? '@' . e($roleName) : e((string) $r['discord_role_id']) ?></span>
<?php else: ?>
<span class="text-muted">—</span>
<?php endif; ?>
</td>
<td>
<?php if ($r['roster_order'] !== null): ?>
<span class="badge badge-active">Gruppe #<?= (int) $r['roster_order'] ?></span>
<?php else: ?>
<span class="text-muted">—</span>
<?php endif; ?>
</td>
<td><?= (int) $r['user_count'] ?></td>
<td><?= (int) $r['permission_count'] ?></td>
<td>
<div class="actions">
<a class="icon-button" href="/admin/role_form.php?id=<?= (int) $r['id'] ?>" title="Bearbeiten" aria-label="Bearbeiten"><?= icon('edit') ?></a>
<?php if (!$r['is_system']): ?>
<form class="inline-form" method="post" action="/admin/role_delete.php" data-confirm="Diese Berechtigungsgruppe wirklich löschen?" data-confirm-title="Gruppe löschen" data-confirm-danger data-confirm-ok="Löschen">
<?= csrf_field() ?>
<input type="hidden" name="id" value="<?= (int) $r['id'] ?>">
<button type="submit" class="icon-button icon-button-danger" title="Löschen" aria-label="Löschen"><?= icon('trash') ?></button>
</form>
<?php endif; ?>
</div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<?php include __DIR__ . '/../includes/footer.php'; ?>