Revert "Adminbereich mit Rollen und Nutzerauswertung ergänzen"

This reverts commit e432943ea7.
This commit is contained in:
Eugenius Naumenko
2026-10-10 20:27:55 +00:00
parent e432943ea7
commit 2447537652
14 changed files with 18 additions and 634 deletions
-17
View File
@@ -125,23 +125,6 @@ func (s *Server) requireAuth(next http.Handler) http.Handler {
})
}
// Admin rights are read from PostgreSQL for every request. A previously
// issued token does not preserve privileges after an account is demoted.
func (s *Server) requireAdmin(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
user, err := s.store.GetUser(r.Context(), currentUserID(r))
if err != nil {
writeError(w, http.StatusInternalServerError, err)
return
}
if user.Role != "admin" {
writeError(w, http.StatusForbidden, nil)
return
}
next.ServeHTTP(w, r)
})
}
func currentUserID(r *http.Request) string {
value, _ := r.Context().Value(userIDKey).(string)
return value