Add missing handle validation to templates
This commit is contained in:
@@ -196,6 +196,10 @@ func (svc template) Create(ctx context.Context, new *types.Template) (tpl *types
|
||||
)
|
||||
|
||||
err = func() (err error) {
|
||||
if !handle.IsValid(new.Handle) {
|
||||
return TemplateErrInvalidHandle()
|
||||
}
|
||||
|
||||
if !svc.ac.CanCreateTemplate(ctx) {
|
||||
return TemplateErrNotAllowedToCreate()
|
||||
}
|
||||
@@ -232,6 +236,10 @@ func (svc template) Update(ctx context.Context, upd *types.Template) (tpl *types
|
||||
return TemplateErrInvalidID()
|
||||
}
|
||||
|
||||
if !handle.IsValid(upd.Handle) {
|
||||
return TemplateErrInvalidHandle()
|
||||
}
|
||||
|
||||
if tpl, err = store.LookupTemplateByID(ctx, svc.store, upd.ID); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user