Every "oe/ae/ue" spelling throughout the UI text and comments (fuer, loeschen, koennen, ...) was my own typo, not an encoding bug - the charset fix in the last commit was unrelated. Replaced all of them with proper ö/ä/ü across every PHP file and the README. Also fix table rows rendering inconsistently: `.actions` and the status badges were applying `display:flex` directly to a <td>, which fights the table layout model and renders unreliably across browsers. Moved the flex layout into a wrapper <div> inside each cell instead, and restyled row-level delete buttons as plain text links so they match the height of the "Bearbeiten" link exactly. Tables also get a horizontal-scroll wrapper so narrow viewports scroll instead of squeezing cell content. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
61 lines
2.3 KiB
PHP
61 lines
2.3 KiB
PHP
<?php
|
|
require_once __DIR__ . '/../includes/bootstrap.php';
|
|
require_permission('roles.manage');
|
|
|
|
$roles = db()->query(
|
|
'SELECT r.id, r.name, r.description, r.is_system,
|
|
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();
|
|
|
|
$pageTitle = 'Berechtigungsgruppen';
|
|
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.</p>
|
|
|
|
<p><a class="button" href="/admin/role_form.php">Neue Gruppe anlegen</a></p>
|
|
|
|
<div class="table-scroll">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Beschreibung</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><?= e($r['description']) ?></td>
|
|
<td><?= (int) $r['user_count'] ?></td>
|
|
<td><?= (int) $r['permission_count'] ?></td>
|
|
<td>
|
|
<div class="actions">
|
|
<a href="/admin/role_form.php?id=<?= (int) $r['id'] ?>">Bearbeiten</a>
|
|
<?php if (!$r['is_system']): ?>
|
|
<form class="inline-form" method="post" action="/admin/role_delete.php" onsubmit="return confirm('Diese Berechtigungsgruppe wirklich löschen?');">
|
|
<?= csrf_field() ?>
|
|
<input type="hidden" name="id" value="<?= (int) $r['id'] ?>">
|
|
<button type="submit" class="text-button">Löschen</button>
|
|
</form>
|
|
<?php endif; ?>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<?php include __DIR__ . '/../includes/footer.php'; ?>
|