本站源代码
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.

71 satır
2.6KB

  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Copyright 2019 The Gitea Authors. All rights reserved.
  3. // Use of this source code is governed by a MIT-style
  4. // license that can be found in the LICENSE file.
  5. package auth
  6. import (
  7. "code.gitea.io/gitea/models"
  8. "code.gitea.io/gitea/modules/structs"
  9. "gitea.com/macaron/binding"
  10. "gitea.com/macaron/macaron"
  11. )
  12. // ________ .__ __ .__
  13. // \_____ \_______ _________ ____ |__|____________ _/ |_|__| ____ ____
  14. // / | \_ __ \/ ___\__ \ / \| \___ /\__ \\ __\ |/ _ \ / \
  15. // / | \ | \/ /_/ > __ \| | \ |/ / / __ \| | | ( <_> ) | \
  16. // \_______ /__| \___ (____ /___| /__/_____ \(____ /__| |__|\____/|___| /
  17. // \/ /_____/ \/ \/ \/ \/ \/
  18. // CreateOrgForm form for creating organization
  19. type CreateOrgForm struct {
  20. OrgName string `binding:"Required;AlphaDashDot;MaxSize(40)" locale:"org.org_name_holder"`
  21. Visibility structs.VisibleType
  22. RepoAdminChangeTeamAccess bool
  23. }
  24. // Validate validates the fields
  25. func (f *CreateOrgForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  26. return validate(errs, ctx.Data, f, ctx.Locale)
  27. }
  28. // UpdateOrgSettingForm form for updating organization settings
  29. type UpdateOrgSettingForm struct {
  30. Name string `binding:"Required;AlphaDashDot;MaxSize(40)" locale:"org.org_name_holder"`
  31. FullName string `binding:"MaxSize(100)"`
  32. Description string `binding:"MaxSize(255)"`
  33. Website string `binding:"ValidUrl;MaxSize(255)"`
  34. Location string `binding:"MaxSize(50)"`
  35. Visibility structs.VisibleType
  36. MaxRepoCreation int
  37. RepoAdminChangeTeamAccess bool
  38. }
  39. // Validate validates the fields
  40. func (f *UpdateOrgSettingForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  41. return validate(errs, ctx.Data, f, ctx.Locale)
  42. }
  43. // ___________
  44. // \__ ___/___ _____ _____
  45. // | |_/ __ \\__ \ / \
  46. // | |\ ___/ / __ \| Y Y \
  47. // |____| \___ >____ /__|_| /
  48. // \/ \/ \/
  49. // CreateTeamForm form for creating team
  50. type CreateTeamForm struct {
  51. TeamName string `binding:"Required;AlphaDashDot;MaxSize(30)"`
  52. Description string `binding:"MaxSize(255)"`
  53. Permission string
  54. Units []models.UnitType
  55. }
  56. // Validate validates the fields
  57. func (f *CreateTeamForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  58. return validate(errs, ctx.Data, f, ctx.Locale)
  59. }
上海开阖软件有限公司 沪ICP备12045867号-1