build list should require read access, no write

This commit is contained in:
Brad Rydzewski 2019-05-26 10:50:17 -07:00
parent 8ae7ae7ec8
commit 9edc42773f
2 changed files with 4 additions and 4 deletions

View file

@ -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)) ).Post("/repair", repos.HandleRepair(s.Hooks, s.Repoz, s.Repos, s.Users, s.System.Link))
r.Route("/builds", func(r chi.Router) { 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.With(acl.CheckWriteAccess()).Post("/", builds.HandleCreate(s.Repos, s.Commits, s.Triggerer))
r.Get("/latest", builds.HandleLast(s.Repos, s.Builds, s.Stages)) r.Get("/latest", builds.HandleLast(s.Repos, s.Builds, s.Stages))

View file

@ -44,7 +44,7 @@ var noContext = context.Background()
// POST /rpc/v2/nodes/:machine // POST /rpc/v2/nodes/:machine
func HandleJoin() http.HandlerFunc { func HandleJoin() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { 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 // DELETE /rpc/v2/nodes/:machine
func HandleLeave() http.HandlerFunc { func HandleLeave() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { 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 // GET /rpc/v2/ping
func HandlePing() http.HandlerFunc { func HandlePing() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(200) writeOK(w) // this is a no-op
} }
} }