User/Usergroup Pages first draft

This commit is contained in:
root
2025-10-27 19:36:44 +00:00
parent a76567969a
commit d65585b821
12 changed files with 769 additions and 51 deletions
+22
View File
@@ -45,6 +45,8 @@ import {
removeServer,
setServerApiKey
} from './setup/index.js';
import { listUsers } from './users/index.js';
import { listGroups } from './groups/index.js';
dotenv.config();
@@ -1671,6 +1673,26 @@ app.get('/api/auth/session', (req, res) => {
res.json({ user: sanitizeUser(user) });
});
app.get('/api/users', (req, res) => {
try {
const users = listUsers();
res.json({ items: users, total: users.length });
} catch (error) {
console.error('⚠️ [Users] Abruf der Benutzerliste fehlgeschlagen:', error);
res.status(500).json({ error: 'USERS_FETCH_FAILED' });
}
});
app.get('/api/groups', (req, res) => {
try {
const groups = listGroups();
res.json({ items: groups, total: groups.length });
} catch (error) {
console.error('⚠️ [Groups] Abruf der Benutzergruppenliste fehlgeschlagen:', error);
res.status(500).json({ error: 'GROUPS_FETCH_FAILED' });
}
});
// Superuser Setup
app.get('/api/auth/superuser/status', (req, res) => {
const exists = hasSuperuser();