Asked for: normal members must not see anything of the alliances - not the alliance member list, not their
calendar entries - and the alliance things out of the patch notes.
- consilium_can_view() is now consilium.view only (before: every legion member). Normal members get no menu entry,
no Consilium page, no member-list tab, no Consilium raids (raids page, dashboard, calendar) and no share button
or Consilium hints on the map (tactics_api.php: consilium flag and consilium_share need consilium.view).
- Calendar: Consilium entries only with consilium.view - calendar_can_view(), the iCal subscription, the "Für wen?"
option and the moderation queue and its counter.
- member.php: profiles of allied members only for those who see the Consilium.
- Allies no longer counted in legion lists: Lumipunkte rank on the dashboard, premade invite candidates, class
counts on the professions page.
- Map: normal members in a shared session see guests like other participants, without 🤝 and legion.
- Patch note about the Consilium removed; permission description updated (schema 70); admin setup hint and README.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
148 lines
9.1 KiB
PHP
148 lines
9.1 KiB
PHP
<?php
|
||
/**
|
||
* Consilium Elyseum verwalten: die verbuendeten Legionen und welche Mitglieder zu welcher gehoeren
|
||
* (includes/consilium.php). Formulare gehen an admin/consilium_action.php.
|
||
*/
|
||
require_once __DIR__ . '/../includes/bootstrap.php';
|
||
require_once __DIR__ . '/../includes/consilium.php';
|
||
require_permission('consilium.manage');
|
||
|
||
$legions = consilium_legions();
|
||
$members = consilium_members(true);
|
||
|
||
// Gruppen des Consiliums: consilium.view ohne dashboard.view (Gruppen mit beidem gehoeren zur Legion, z.B. Administrator)
|
||
$groups = db()->query(
|
||
"SELECT r.id, COALESCE(NULLIF(r.display_name, ''), r.name) AS label, r.discord_role_id
|
||
FROM roles r
|
||
JOIN role_permissions rp ON rp.role_id = r.id
|
||
JOIN permissions p ON p.id = rp.permission_id
|
||
WHERE p.`key` = 'consilium.view'
|
||
AND NOT EXISTS (SELECT 1 FROM role_permissions rp2 JOIN permissions p2 ON p2.id = rp2.permission_id
|
||
WHERE rp2.role_id = r.id AND p2.`key` = 'dashboard.view')
|
||
ORDER BY label"
|
||
)->fetchAll();
|
||
$setUp = $groups && $legions;
|
||
$nameOf = static fn (array $m): string => $m['display_name'] !== '' ? (string) $m['display_name'] : (string) $m['username'];
|
||
|
||
$pageTitle = CONSILIUM_NAME;
|
||
include __DIR__ . '/../includes/header.php';
|
||
?>
|
||
<div class="panel consilium-hero">
|
||
<h1><?= icon('shield-check') ?> <?= e(CONSILIUM_NAME) ?></h1>
|
||
<p class="text-muted">
|
||
Das Bündnis mit anderen Legionen. Ihre Mitglieder melden sich über Discord an, haben dort die Rolle
|
||
„<?= e(CONSILIUM_NAME) ?>“ und sehen auf der Website nur ihre eigene Ansicht: die Mitglieder des Consiliums,
|
||
Consilium-Raids, Consilium-Termine und die Karten-Sitzungen, die ihr für sie freigebt - nichts von der Legion.
|
||
</p>
|
||
<details class="consilium-setup"<?= $setUp ? '' : ' open' ?>>
|
||
<summary>So richtest du das Consilium ein</summary>
|
||
<ol>
|
||
<li>Unter <a href="/admin/roles.php">Berechtigungsgruppen</a> eine Gruppe anlegen (z. B. „<?= e(CONSILIUM_NAME) ?>“)
|
||
und mit der Discord-Rolle „<?= e(CONSILIUM_NAME) ?>“ verknüpfen.</li>
|
||
<li>Der Gruppe das Recht <code>consilium.view</code> geben - und dazu <code>consilium.draw</code>, wenn sie in
|
||
freigegebenen Karten-Sitzungen mitzeichnen darf. <strong>Kein <code>dashboard.view</code></strong>, sonst zählt
|
||
sie als Legion und sieht alles.</li>
|
||
<li>Unten die verbündeten Legionen anlegen und ihre Mitglieder zuordnen. Jedes Mitglied kann seine Legion auch
|
||
selbst unter „Mein Profil“ wählen.</li>
|
||
<li>Neue Konten schaltet ihr wie gewohnt in der <a href="/admin/users.php">Benutzerverwaltung</a> frei.</li>
|
||
<li>Wer aus unserer Legion das Consilium sehen soll (z. B. die Leitung), braucht ebenfalls
|
||
<code>consilium.view</code> über seine Gruppe. Normale Mitglieder sehen vom Consilium nichts - keinen
|
||
Menüpunkt, keine Mitglieder, keine Raids, Termine oder Karten-Freigaben.</li>
|
||
</ol>
|
||
<p class="consilium-setup-status">
|
||
<strong>Gruppen des Consiliums</strong> <span class="text-muted">(<code>consilium.view</code> ohne <code>dashboard.view</code>):</span>
|
||
<?php if (!$groups): ?>
|
||
<span class="text-muted">noch keine</span>
|
||
<?php else: ?>
|
||
<?php foreach ($groups as $group): ?>
|
||
<?= role_tag_html((string) $group['label']) ?>
|
||
<?php if ($group['discord_role_id'] === null): ?><span class="text-muted">(ohne Discord-Rolle)</span><?php endif; ?>
|
||
<?php endforeach; ?>
|
||
<?php endif; ?>
|
||
</p>
|
||
</details>
|
||
</div>
|
||
|
||
<div class="panel">
|
||
<h2>Legionen im Consilium</h2>
|
||
<?php if (!$legions): ?>
|
||
<p class="text-muted">Noch keine verbündete Legion angelegt.</p>
|
||
<?php else: ?>
|
||
<ul class="consilium-legion-list">
|
||
<?php foreach ($legions as $i => $legion): ?>
|
||
<li>
|
||
<form method="post" action="/admin/consilium_action.php" class="consilium-legion-rename">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="legion_rename">
|
||
<input type="hidden" name="id" value="<?= $legion['id'] ?>">
|
||
<input type="text" name="name" value="<?= e($legion['name']) ?>" maxlength="<?= CONSILIUM_LEGION_NAME_MAX ?>" required aria-label="Name der Legion">
|
||
<button type="submit" class="button-secondary button-small">Umbenennen</button>
|
||
</form>
|
||
<span class="text-muted consilium-legion-count"><?= $legion['member_count'] ?> <?= $legion['member_count'] === 1 ? 'Mitglied' : 'Mitglieder' ?></span>
|
||
<form method="post" action="/admin/consilium_action.php" class="inline-form">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="legion_move">
|
||
<input type="hidden" name="id" value="<?= $legion['id'] ?>">
|
||
<button type="submit" name="direction" value="up" class="icon-button" title="Nach oben"<?= $i === 0 ? ' disabled' : '' ?>>▲</button>
|
||
<button type="submit" name="direction" value="down" class="icon-button" title="Nach unten"<?= $i === count($legions) - 1 ? ' disabled' : '' ?>>▼</button>
|
||
</form>
|
||
<form method="post" action="/admin/consilium_action.php" class="inline-form"
|
||
data-confirm="Die Legion „<?= e($legion['name']) ?>“ löschen? Ihre Mitglieder bleiben im Consilium, nur ohne Legion." data-confirm-title="Legion löschen" data-confirm-danger data-confirm-ok="Löschen">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="legion_delete">
|
||
<input type="hidden" name="id" value="<?= $legion['id'] ?>">
|
||
<button type="submit" class="icon-button icon-button-danger" title="Löschen" aria-label="<?= e($legion['name']) ?> löschen"><?= icon('trash') ?></button>
|
||
</form>
|
||
</li>
|
||
<?php endforeach; ?>
|
||
</ul>
|
||
<?php endif; ?>
|
||
<form method="post" action="/admin/consilium_action.php" class="consilium-legion-add">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="legion_add">
|
||
<input type="text" name="name" maxlength="<?= CONSILIUM_LEGION_NAME_MAX ?>" required placeholder="Name der verbündeten Legion" aria-label="Name der verbündeten Legion">
|
||
<button type="submit">+ Legion hinzufügen</button>
|
||
</form>
|
||
</div>
|
||
|
||
<div class="panel">
|
||
<h2>Mitglieder des Consiliums <span class="chip-count"><?= count($members) ?></span></h2>
|
||
<?php if (!$members): ?>
|
||
<p class="text-muted">Noch niemand. Wer die Discord-Rolle „<?= e(CONSILIUM_NAME) ?>“ hat und sich auf der Website anmeldet, erscheint hier.</p>
|
||
<?php else: ?>
|
||
<div class="table-scroll">
|
||
<table>
|
||
<thead>
|
||
<tr><th>Mitglied</th><th>Discord</th><th>Legion</th><th>Zuletzt aktiv</th></tr>
|
||
</thead>
|
||
<tbody>
|
||
<?php foreach ($members as $member): ?>
|
||
<tr>
|
||
<td>
|
||
<span class="consilium-member-name"><?= avatar_html($member, 28) ?> <?= e($nameOf($member)) ?></span>
|
||
<?php if ($member['status'] === 'pending'): ?><a class="badge badge-pending" href="/admin/users.php">Wartet auf Freischaltung</a><?php endif; ?>
|
||
</td>
|
||
<td class="text-muted"><?= e((string) ($member['discord_username'] ?? '')) ?></td>
|
||
<td>
|
||
<form method="post" action="/admin/consilium_action.php" class="inline-form">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="member_legion">
|
||
<input type="hidden" name="user_id" value="<?= (int) $member['id'] ?>">
|
||
<select name="legion_id" onchange="this.form.submit()" aria-label="Legion von <?= e($nameOf($member)) ?>">
|
||
<option value="">– keine –</option>
|
||
<?php foreach ($legions as $legion): ?>
|
||
<option value="<?= $legion['id'] ?>"<?= (int) $member['consilium_legion_id'] === $legion['id'] ? ' selected' : '' ?>><?= e($legion['name']) ?></option>
|
||
<?php endforeach; ?>
|
||
</select>
|
||
<noscript><button type="submit" class="button-secondary button-small">Speichern</button></noscript>
|
||
</form>
|
||
</td>
|
||
<td class="text-muted"><?= e(last_active_label($member['last_active'] ?? null)) ?></td>
|
||
</tr>
|
||
<?php endforeach; ?>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php include __DIR__ . '/../includes/footer.php'; ?>
|