From 10f5da47270b12f0eb26129a8c47cea79fd12481 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Sat, 3 Sep 2022 10:40:25 -0800 Subject: [PATCH] comment out admin mw --- backend/app/api/middleware.go | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/backend/app/api/middleware.go b/backend/app/api/middleware.go index bb8f898..c062ec2 100644 --- a/backend/app/api/middleware.go +++ b/backend/app/api/middleware.go @@ -65,21 +65,19 @@ func (a *app) mwAuthToken(next http.Handler) http.Handler { // mwAdminOnly is a middleware that extends the mwAuthToken middleware to only allow // requests from superusers. -func (a *app) mwAdminOnly(next http.Handler) http.Handler { +// func (a *app) mwAdminOnly(next http.Handler) http.Handler { +// mw := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { +// usr := services.UseUserCtx(r.Context()) - mw := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - usr := services.UseUserCtx(r.Context()) +// if !usr.IsSuperuser { +// server.RespondUnauthorized(w) +// return +// } - if !usr.IsSuperuser { - server.RespondUnauthorized(w) - return - } - - next.ServeHTTP(w, r) - }) - - return a.mwAuthToken(mw) -} +// next.ServeHTTP(w, r) +// }) +// return a.mwAuthToken(mw) +// } // mqStripTrailingSlash is a middleware that will strip trailing slashes from the request path. func mwStripTrailingSlash(next http.Handler) http.Handler {