You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

repo_tag_form.go 734B

123456789101112131415161718192021222324252627
  1. // Copyright 2021 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package forms
  5. import (
  6. "net/http"
  7. "code.gitea.io/gitea/modules/context"
  8. "code.gitea.io/gitea/modules/web/middleware"
  9. "gitea.com/go-chi/binding"
  10. )
  11. // ProtectTagForm form for changing protected tag settings
  12. type ProtectTagForm struct {
  13. NamePattern string `binding:"Required;GlobOrRegexPattern"`
  14. AllowlistUsers string
  15. AllowlistTeams string
  16. }
  17. // Validate validates the fields
  18. func (f *ProtectTagForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
  19. ctx := context.GetContext(req)
  20. return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
  21. }