comment out admin mw

This commit is contained in:
Hayden 2022-09-03 10:40:25 -08:00
parent 68204a4f22
commit 10f5da4727

View file

@ -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 {