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.

org.go 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. RepoAccess string
  56. CanCreateOrgRepo bool
  57. }
  58. // Validate validates the fields
  59. func (f *CreateTeamForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
  60. return validate(errs, ctx.Data, f, ctx.Locale)
  61. }