fix: Block creating workspaces with deleted templates (#5019)

@coadler and @deansheather bricked a Coder deployment with this...
This commit is contained in:
Kyle Carberry
2022-11-10 16:53:14 -06:00
committed by GitHub
parent 927c241995
commit 4b7c710755
2 changed files with 27 additions and 1 deletions

View File

@ -283,7 +283,12 @@ func (api *API) postWorkspacesByOrganization(rw http.ResponseWriter, r *http.Req
})
return
}
if template.Deleted {
httpapi.Write(ctx, rw, http.StatusNotFound, codersdk.Response{
Message: fmt.Sprintf("Template %q has been deleted!", template.Name),
})
return
}
if !api.Authorize(r, rbac.ActionRead, template) {
httpapi.ResourceNotFound(rw)
return