mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
fix: fix template edit overriding with flag defaults (#11564)
This commit is contained in:
@ -72,6 +72,9 @@ func Template(t testing.TB, db database.Store, seed database.Template) database.
|
||||
seed.OrganizationID.String(): []rbac.Action{rbac.ActionRead},
|
||||
}
|
||||
}
|
||||
if seed.UserACL == nil {
|
||||
seed.UserACL = database.TemplateACL{}
|
||||
}
|
||||
err := db.InsertTemplate(genCtx, database.InsertTemplateParams{
|
||||
ID: id,
|
||||
CreatedAt: takeFirst(seed.CreatedAt, dbtime.Now()),
|
||||
|
@ -6374,6 +6374,7 @@ func (q *FakeQuerier) UpdateTemplateMetaByID(_ context.Context, arg database.Upd
|
||||
tpl.Description = arg.Description
|
||||
tpl.Icon = arg.Icon
|
||||
tpl.GroupACL = arg.GroupACL
|
||||
tpl.AllowUserCancelWorkspaceJobs = arg.AllowUserCancelWorkspaceJobs
|
||||
q.templates[idx] = tpl
|
||||
return nil
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ func (c *DeviceAuth) AuthorizeDevice(ctx context.Context) (*codersdk.ExternalAut
|
||||
// return a better error.
|
||||
switch resp.StatusCode {
|
||||
case http.StatusTooManyRequests:
|
||||
return nil, fmt.Errorf("rate limit hit, unable to authorize device. please try again later")
|
||||
return nil, xerrors.New("rate limit hit, unable to authorize device. please try again later")
|
||||
default:
|
||||
return nil, err
|
||||
}
|
||||
|
@ -1,10 +1,11 @@
|
||||
package promoauth
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
)
|
||||
|
||||
type rateLimits struct {
|
||||
@ -81,7 +82,7 @@ func (p *headerParser) string(key string) string {
|
||||
|
||||
v := p.header.Get(key)
|
||||
if v == "" {
|
||||
p.errors[key] = fmt.Errorf("missing header %q", key)
|
||||
p.errors[key] = xerrors.Errorf("missing header %q", key)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
@ -669,7 +669,7 @@ func (api *API) patchTemplateMeta(rw http.ResponseWriter, r *http.Request) {
|
||||
|
||||
groupACL := template.GroupACL
|
||||
if req.DisableEveryoneGroupAccess {
|
||||
groupACL = database.TemplateACL{}
|
||||
delete(groupACL, template.OrganizationID.String())
|
||||
}
|
||||
|
||||
var err error
|
||||
|
Reference in New Issue
Block a user