org.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2015 The Gogs Authors. All rights reserved.
  2. // Copyright 2018 Gitote. All rights reserved.
  3. //
  4. // This source code is licensed under the MIT license found in the
  5. // LICENSE file in the root directory of this source tree.
  6. package form
  7. import (
  8. "github.com/go-macaron/binding"
  9. "gopkg.in/macaron.v1"
  10. )
  11. type CreateOrg struct {
  12. OrgName string `binding:"Required;AlphaDashDot;MaxSize(35)" locale:"org.org_name_holder"`
  13. }
  14. func (f *CreateOrg) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  15. return validate(errs, ctx.Data, f, ctx.Locale)
  16. }
  17. type UpdateOrgSetting struct {
  18. Name string `binding:"Required;AlphaDashDot;MaxSize(35)" locale:"org.org_name_holder"`
  19. FullName string `binding:"MaxSize(100)"`
  20. Description string `binding:"MaxSize(255)"`
  21. Website string `binding:"Url;MaxSize(100)"`
  22. Location string `binding:"MaxSize(50)"`
  23. IsVerified bool
  24. MaxRepoCreation int
  25. }
  26. func (f *UpdateOrgSetting) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  27. return validate(errs, ctx.Data, f, ctx.Locale)
  28. }
  29. type CreateTeam struct {
  30. TeamName string `binding:"Required;AlphaDashDot;MaxSize(30)"`
  31. Description string `binding:"MaxSize(255)"`
  32. Permission string
  33. }
  34. func (f *CreateTeam) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  35. return validate(errs, ctx.Data, f, ctx.Locale)
  36. }