From 9edc42773f313a5a5240d01e3dc37dbc3eacc50e Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Sun, 26 May 2019 10:50:17 -0700 Subject: [PATCH] build list should require read access, no write --- handler/api/api.go | 2 +- operator/manager/rpc2/handler.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/handler/api/api.go b/handler/api/api.go index 5dec8c73..45b11bf4 100644 --- a/handler/api/api.go +++ b/handler/api/api.go @@ -169,7 +169,7 @@ func (s Server) Handler() http.Handler { ).Post("/repair", repos.HandleRepair(s.Hooks, s.Repoz, s.Repos, s.Users, s.System.Link)) r.Route("/builds", func(r chi.Router) { - r.With(acl.CheckWriteAccess()).Get("/", builds.HandleList(s.Repos, s.Builds)) + r.Get("/", builds.HandleList(s.Repos, s.Builds)) r.With(acl.CheckWriteAccess()).Post("/", builds.HandleCreate(s.Repos, s.Commits, s.Triggerer)) r.Get("/latest", builds.HandleLast(s.Repos, s.Builds, s.Stages)) diff --git a/operator/manager/rpc2/handler.go b/operator/manager/rpc2/handler.go index 041d9904..311299fb 100644 --- a/operator/manager/rpc2/handler.go +++ b/operator/manager/rpc2/handler.go @@ -44,7 +44,7 @@ var noContext = context.Background() // POST /rpc/v2/nodes/:machine func HandleJoin() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(200) // this is a no-op + writeOK(w) // this is a no-op } } @@ -54,7 +54,7 @@ func HandleJoin() http.HandlerFunc { // DELETE /rpc/v2/nodes/:machine func HandleLeave() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(200) // this is a no-op + writeOK(w) // this is a no-op } } @@ -64,7 +64,7 @@ func HandleLeave() http.HandlerFunc { // GET /rpc/v2/ping func HandlePing() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(200) + writeOK(w) // this is a no-op } }