3
0
corteza/compose/rest/middleware.go
Denis Arh b66ed81136 More flexible "compose", move to Corteza
- more control over starting procedure, cli commands...
 - fix package paths
 - renaming symbols, comments, strings from Crust to Corteza
2019-05-24 12:42:35 +02:00

19 lines
425 B
Go

package rest
import (
"net/http"
"github.com/cortezaproject/corteza-server/compose/internal/service"
)
func middlewareAllowedAccess(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if !service.DefaultAccessControl.CanAccess(r.Context()) {
http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)
return
}
next.ServeHTTP(w, r)
})
}