feat: Admin-Benutzerverwaltung + Dashboard-Layout-Fixes

Backend:
- AdminEndpoint.cs: 5 Endpunkte (List, Create, Update, Reset PW, Delete) - Admin-only
- DatabaseService: CreateUser(), UpdateUserAdmin(), DeleteUser() (kaskadiert Tokens + Shares)
- Route in Program.cs registriert

Frontend:
- admin-page.js: User-Liste mit Edit/Delete, Inline-Formular Create/Edit
- api.js: 5 Admin-API-Funktionen
- index.html: Template tpl-admin, Script-Tag, Dashboard-Link 'Benutzerverwaltung'
- dashboard.js: Admin-Link nur für Admins sichtbar
- form.css: Styles für admin-user-list, admin-user-row, admin-checkbox-row
- dashboard.css: Header-Overflow-Fix, Agents vor Cronjobs
- index.html: Template-Reihenfolge Agents vor Cronjobs

TODO: User-Management als erledigt markiert
This commit is contained in:
Meleki committed 2026-03-05 19:19:16 +01:00
1 parent 489b5e0eb0
commit 3ef78b5eb1
10 files changed
+667 -57

No files matched your search

+56
View File
@@ -407,6 +407,62 @@ async function apiDeleteShare(token) {
return fetch(`/api/shared/${token}`, { method: 'DELETE' });
}
// ── Admin API ──
async function apiAdminGetUsers() {
const resp = await fetch('/api/admin/users');
if (!resp.ok) throw new Error('Fehler beim Laden der Benutzer');
return resp.json();
}
async function apiAdminCreateUser(data) {
const resp = await fetch('/api/admin/users', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data)
});
if (!resp.ok) {
const err = await resp.json();
throw new Error(err.error || 'Fehler beim Erstellen');
}
return resp.json();
}
async function apiAdminUpdateUser(userId, data) {
const resp = await fetch('/api/admin/users/' + userId, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data)
});
if (!resp.ok) {
const err = await resp.json();
throw new Error(err.error || 'Fehler beim Aktualisieren');
}
return resp.json();
}
async function apiAdminResetPassword(userId, password) {
const resp = await fetch('/api/admin/users/' + userId + '/password', {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ password })
});
if (!resp.ok) {
const err = await resp.json();
throw new Error(err.error || 'Fehler beim Zurücksetzen');
}
return resp.json();
}
async function apiAdminDeleteUser(userId) {
const resp = await fetch('/api/admin/users/' + userId, { method: 'DELETE' });
if (!resp.ok) {
const err = await resp.json();
throw new Error(err.error || 'Fehler beim Löschen');
}
return resp.json();
}
// ── Backup API ──
async function apiBackupDb() {