From f7999cbe55fe0b7c37aceef524cdb3a493f1bb9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Br=C3=BCckner?= Date: Wed, 3 Jun 2026 16:08:05 +0200 Subject: [PATCH] fix: remove role gate from Settings, all strings in English --- server.ts | 16 ++++++------- src/App.tsx | 12 ++++------ src/components/LoginPage.tsx | 2 +- src/components/Settings.tsx | 45 ++++++++++++++---------------------- 4 files changed, 31 insertions(+), 44 deletions(-) diff --git a/server.ts b/server.ts index be9078f..40d2730 100644 --- a/server.ts +++ b/server.ts @@ -156,7 +156,7 @@ async function startServer() { app.get('/api/auth/azure', async (_req, res) => { const msalClient = getMsalClient(); if (!msalClient) { - return res.redirect('/?auth_error=Azure+Login+nicht+konfiguriert'); + return res.redirect('/?auth_error=Azure+login+not+configured'); } const appUrl = process.env.APP_URL || `http://localhost:${PORT}`; const redirectUri = getSetting('azure_redirect_uri') || `${appUrl}/api/auth/azure/callback`; @@ -168,7 +168,7 @@ async function startServer() { res.redirect(authCodeUrl); } catch (err: any) { console.error('[Azure Auth] getAuthCodeUrl error:', err); - res.redirect('/?auth_error=Microsoft+Login+konnte+nicht+gestartet+werden'); + res.redirect('/?auth_error=Failed+to+start+Microsoft+login'); } }); @@ -180,11 +180,11 @@ async function startServer() { return res.redirect(`/?auth_error=${msg}`); } if (!code) { - return res.redirect('/?auth_error=Kein+Autorisierungscode+erhalten'); + return res.redirect('/?auth_error=No+authorization+code+received'); } const msalClient = getMsalClient(); if (!msalClient) { - return res.redirect('/?auth_error=Azure+Login+nicht+konfiguriert'); + return res.redirect('/?auth_error=Azure+login+not+configured'); } const appUrl = process.env.APP_URL || `http://localhost:${PORT}`; const redirectUri = getSetting('azure_redirect_uri') || `${appUrl}/api/auth/azure/callback`; @@ -197,7 +197,7 @@ async function startServer() { const email = (result.account?.username ?? '').toLowerCase(); const name = result.account?.name || email; if (!email) { - return res.redirect('/?auth_error=Keine+E-Mail+von+Microsoft+erhalten'); + return res.redirect('/?auth_error=No+email+returned+by+Microsoft'); } let user = db.prepare('SELECT id, name, role, email FROM users WHERE email = ?').get(email) as User | undefined; if (!user) { @@ -210,14 +210,14 @@ async function startServer() { res.redirect(`/?token=${encodeURIComponent(token)}`); } catch (err: any) { console.error('[Azure Auth] acquireTokenByCode error:', err); - res.redirect('/?auth_error=Authentifizierung+fehlgeschlagen'); + res.redirect('/?auth_error=Authentication+failed'); } }); // ------------------------------------------------------------- // RESTFUL API: Settings (admin only) // ------------------------------------------------------------- - app.get('/api/settings', requireAuth, requireAdmin, (_req, res) => { + app.get('/api/settings', requireAuth, (_req, res) => { try { res.json(maskSettings(getAllSettings())); } catch (err: any) { @@ -225,7 +225,7 @@ async function startServer() { } }); - app.put('/api/settings', requireAuth, requireAdmin, (req, res) => { + app.put('/api/settings', requireAuth, (req, res) => { try { const allowed = ['azure_enabled', 'azure_client_id', 'azure_tenant_id', 'azure_client_secret', 'azure_redirect_uri', 'checkmk_api_url', 'checkmk_api_secret', 'checkmk_sync_interval_ms']; diff --git a/src/App.tsx b/src/App.tsx index 5e22c77..995af59 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -92,10 +92,10 @@ export default function App() { saveSession(urlToken, user); setCurrentUser(user); } else { - setOauthError('Anmeldung fehlgeschlagen. Bitte erneut versuchen.'); + setOauthError('Login failed. Please try again.'); } } catch { - setOauthError('Server nicht erreichbar.'); + setOauthError('Server unreachable. Please try again.'); } finally { setAuthChecked(true); } @@ -371,8 +371,6 @@ export default function App() { setActiveTab('devices'); }; - const isAdmin = currentUser?.role?.toLowerCase() === 'admin'; - const navigationGroups: { label: string | null; items: { id: string; label: string; icon: React.ReactNode }[] }[] = [ { label: null, @@ -401,12 +399,12 @@ export default function App() { { id: 'logs', label: 'Logbook', icon: }, ], }, - ...(isAdmin ? [{ + { label: 'System', items: [ - { id: 'settings', label: 'Einstellungen', icon: }, + { id: 'settings', label: 'Settings', icon: }, ], - }] : []), + }, ]; // Startup check not done yet diff --git a/src/components/LoginPage.tsx b/src/components/LoginPage.tsx index 357b60f..06fcddf 100644 --- a/src/components/LoginPage.tsx +++ b/src/components/LoginPage.tsx @@ -150,7 +150,7 @@ export default function LoginPage({ onLogin, onNavigateToRegister, authError }: <>
- oder + or
@@ -217,15 +207,14 @@ export default function Settings({ currentUser }: SettingsProps) {

Microsoft Entra ID

-

OAuth 2.0 Login für Organisationsaccounts

+

OAuth 2.0 login for organizational accounts

- {/* Toggle */} @@ -251,7 +240,7 @@ export default function Settings({ currentUser }: SettingsProps) { />
- Redirect URI (leer = automatisch) + Redirect URI (leave blank for auto)
@@ -265,7 +254,7 @@ export default function Settings({ currentUser }: SettingsProps) {

CheckMK

-

Geräte-Status-Synchronisation über die CheckMK REST API

+

Device status synchronization via the CheckMK REST API

@@ -290,7 +279,7 @@ export default function Settings({ currentUser }: SettingsProps) { />
- Sync-Intervall (ms) + Sync Interval (ms)
@@ -308,7 +297,7 @@ export default function Settings({ currentUser }: SettingsProps) { ) : ( )} - {saving ? 'Speichert…' : 'Einstellungen speichern'} + {saving ? 'Saving…' : 'Save Settings'}