Quelltext des aktuellen Standes
<?php $this->layout('layouts/admin', [
'page_title' => 'Rolle: ' . $role['name'],
'current_admin_page' => 'roles',
'page_actions' => ($role['is_admin'] ? '<span class="badge badge-admin">Admin-Rolle</span>' : '') . '<a href="/admin/roles/' . $role['id'] . '/edit" class="btn btn-primary">Bearbeiten</a>'
]); ?>
<div class="role-detail">
<?php if (!empty($role['description'])): ?>
<p class="role-description text-muted" style="margin-bottom:1rem;"><?= $this->e($role['description']) ?></p>
<?php endif; ?>
<div class="detail-grid">
<!-- Berechtigungen -->
<section class="detail-section capabilities-section" style="grid-column: span 2;">
<h2><?= $this->t('Berechtigungen') ?> (<?= count($capabilities) ?>)</h2>
<?php if (!empty($capabilities)): ?>
<div class="capability-groups">
<?php
$grouped = [];
foreach ($capabilities as $cap) {
$grouped[$cap['category']][] = $cap;
}
// Deutsche Labels und definierte Sortierung
$categoryLabels = [
'page' => 'Seiten & Dokumentation',
'file' => 'Dateianhänge',
'export' => 'Export',
'workflow' => 'Anträge & Genehmigungen / Workflow',
'admin' => 'Administration',
'assets' => 'Inventar',
'tickets' => 'Ticket-System',
'vault' => 'Passwort-Tresor',
'contracts' => 'Vertragsmanagement',
'contract' => 'Vertragsmanagement',
'loan' => 'Geräteausleihe',
'ipam' => 'IP-Adressverwaltung',
'contacts' => 'Adressbuch',
'contact' => 'Adressbuch',
'ssl' => 'SSL-Zertifikate',
'kanban' => 'Kanban-Board',
'monitoring' => 'Monitoring',
'isms' => 'Informationssicherheit (ISMS)',
'statuspage' => 'Statusseite',
'stock' => 'Lager',
'files' => 'Datei-Explorer',
'unifi' => 'UniFi-Integration',
'backup' => 'Backup',
'vms' => 'Virtualisierung',
'configlog' => 'Konfigurationslog',
'licenses' => 'Lizenzverwaltung',
'phonebook' => 'Telefonbuch',
'budget' => 'Budget',
'order' => 'Bestellungen',
'service' => 'IT-Services',
'cve' => 'CVE / Sicherheitsmeldungen',
'netdiagram' => 'Netzwerkpläne',
'ai_chat' => 'KI-Assistent',
'todos' => 'To-dos / Aufgaben',
'teamboard' => 'Notizbrett',
'maintenance'=> 'Wartung & Instandhaltung',
'api_auto' => 'API-Automatisierung',
];
$sortedGrouped = [];
foreach ($categoryLabels as $key => $label) {
if (isset($grouped[$key])) {
$sortedGrouped[$key] = $grouped[$key];
}
}
foreach ($grouped as $key => $caps) {
if (!isset($sortedGrouped[$key])) {
$sortedGrouped[$key] = $caps;
}
}
?>
<?php foreach ($sortedGrouped as $category => $caps): ?>
<div class="capability-group">
<h3 class="group-title"><?= $this->e($categoryLabels[$category] ?? ucfirst($category)) ?></h3>
<ul class="capability-list">
<?php foreach ($caps as $cap): ?>
<li class="capability-item">
<span class="cap-name"><?= $this->e($cap['name']) ?></span>
<span class="cap-description"><?= $this->e($cap['description']) ?></span>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endforeach; ?>
</div>
<?php else: ?>
<p class="text-muted"><?= $this->te('Keine Berechtigungen zugewiesen.') ?></p>
<?php endif; ?>
</section>
<!-- Benutzer mit dieser Rolle -->
<section class="detail-section users-section">
<h2><?= $this->t('Benutzer mit dieser Rolle ({anzahl})', ['anzahl' => count($users)]) ?></h2>
<?php if (!empty($users)): ?>
<table class="data-table data-table-compact">
<thead>
<tr>
<th scope="col"><?= $this->te('Benutzer') ?></th>
<th scope="col"><?= $this->te('Themengebiet') ?></th>
<th scope="col"><?= $this->te('Zugewiesen am') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($users as $user): ?>
<tr>
<td>
<a href="/admin/users/<?= $user['user_id'] ?? $user['id'] ?? '' ?>">
<?= $this->e($user['display_name'] ?? 'Unbekannt') ?>
</a>
</td>
<td>
<?php if (!empty($user['topic_id'])): ?>
<a href="/topics/<?= $user['topic_id'] ?>">
<?= $this->e($user['topic_name'] ?? '') ?>
</a>
<?php else: ?>
<span class="text-muted"><?= $this->te('Global') ?></span>
<?php endif; ?>
</td>
<td><?= !empty($user['assigned_at']) ? date('d.m.Y', strtotime($user['assigned_at'])) : '-' ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<p class="text-muted"><?= $this->te('Keine Benutzer haben diese Rolle.') ?></p>
<?php endif; ?>
</section>
</div>
<!-- Aktionen -->
<footer class="detail-footer">
<div class="footer-actions">
<a href="/admin/roles/<?= $role['id'] ?>/edit" class="btn btn-primary"><?= $this->te('Bearbeiten') ?></a>
<a href="/admin/roles" class="btn btn-secondary"><?= $this->te('Zurück zur Übersicht') ?></a>
</div>
<?php if (empty($users)): ?>
<form action="/admin/roles/<?= $role['id'] ?>/delete" method="POST" class="delete-form"
onsubmit="return confirm('Rolle wirklich löschen?');">
<input type="hidden" name="_csrf" value="<?= $this->csrf() ?>">
<button type="submit" class="btn btn-danger"><?= $this->te('Rolle löschen') ?></button>
</form>
<?php endif; ?>
</footer>
</div>