mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: return 403 when rebuilding workspace with require_active_version (#11114)
This commit is contained in:
@@ -379,7 +379,7 @@ func (api *API) postWorkspaceBuilds(rw http.ResponseWriter, r *http.Request) {
|
||||
if xerrors.As(err, &buildErr) {
|
||||
var authErr dbauthz.NotAuthorizedError
|
||||
if xerrors.As(err, &authErr) {
|
||||
buildErr.Status = http.StatusUnauthorized
|
||||
buildErr.Status = http.StatusForbidden
|
||||
}
|
||||
|
||||
if buildErr.Status == http.StatusInternalServerError {
|
||||
|
||||
@@ -353,7 +353,7 @@ func (b *Builder) buildTx(authFunc func(action rbac.Action, object rbac.Objecter
|
||||
if err != nil {
|
||||
code := http.StatusInternalServerError
|
||||
if rbac.IsUnauthorizedError(err) {
|
||||
code = http.StatusUnauthorized
|
||||
code = http.StatusForbidden
|
||||
}
|
||||
return BuildError{code, "insert workspace build", err}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user