LuminaWebsite/admin/role_delete.php
Maaxxs 77bb1b3ff5 Use real German umlauts instead of ASCII transliterations
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>
2026-09-18 07:16:15 +02:00

33 lines
1 KiB
PHP

<?php
require_once __DIR__ . '/../includes/bootstrap.php';
require_permission('roles.manage');
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
redirect('/admin/roles.php');
}
verify_csrf();
$id = (int) ($_POST['id'] ?? 0);
$pdo = db();
$stmt = $pdo->prepare('SELECT is_system FROM roles WHERE id = ?');
$stmt->execute([$id]);
$role = $stmt->fetch();
if (!$role) {
set_flash('error', 'Berechtigungsgruppe wurde nicht gefunden.');
} elseif ((int) $role['is_system'] === 1) {
set_flash('error', 'Diese System-Gruppe kann nicht gelöscht werden.');
} else {
$countStmt = $pdo->prepare('SELECT COUNT(*) FROM user_roles WHERE role_id = ?');
$countStmt->execute([$id]);
if ((int) $countStmt->fetchColumn() > 0) {
set_flash('error', 'Diese Gruppe ist noch Benutzern zugewiesen. Bitte zuerst die Zuweisung entfernen.');
} else {
$pdo->prepare('DELETE FROM roles WHERE id = ?')->execute([$id]);
set_flash('success', 'Berechtigungsgruppe wurde gelöscht.');
}
}
redirect('/admin/roles.php');