feat(rbac): Viewer-Rolle durchsetzen — alle Mutations nur für Admins
- middleware.go: RequireAdminForMutations() blockiert POST/PUT/DELETE für Nicht-Admins (GET/HEAD passieren immer durch) - main.go: Middleware in den authed-Gruppe eingehängt — wirkt für alle ~30 Resource-Handler gleichzeitig - api/client.ts: 403 → AntD-Notification "Nur Lesezugriff" statt stiller Fehler - Header: "Nur lesen"-Badge + Tooltip wenn role=viewer - i18n de+en: viewerBadge + viewerHint Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import axios, { type AxiosError } from 'axios'
|
||||
import { message } from 'antd'
|
||||
|
||||
import { useAuthStore } from '../stores/auth'
|
||||
|
||||
@@ -38,6 +39,12 @@ apiClient.interceptors.response.use(
|
||||
window.location.replace('/login')
|
||||
}
|
||||
|
||||
// 403 admin_required → viewer account tried to mutate; show a
|
||||
// one-time notification and let the calling mutation handle the rest.
|
||||
if (error.response?.status === 403) {
|
||||
message.error('Keine Berechtigung — dieser Account hat nur Lesezugriff.', 4)
|
||||
}
|
||||
|
||||
// 503 setup_required → kick to /setup so the wizard takes over.
|
||||
if (
|
||||
error.response?.status === 503 &&
|
||||
|
||||
Reference in New Issue
Block a user