package view import ( "net/http" "git.sr.ht/~gabrielgio/img/pkg/ext" ) type View interface { SetMyselfIn(r *ext.Router) } func Protect(next ext.ErrorRequestHandler) ext.ErrorRequestHandler { return func(w http.ResponseWriter, r *http.Request) error { user := ext.GetUserFromCtx(r) if !user.IsAdmin { http.NotFound(w, r) return nil } return next(w, r) } }