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.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Copyright 2019 The Gitea Authors. All rights reserved.
  3. // SPDX-License-Identifier: MIT
  4. package forms
  5. import (
  6. "net/http"
  7. "code.gitea.io/gitea/modules/context"
  8. "code.gitea.io/gitea/modules/structs"
  9. "code.gitea.io/gitea/modules/web/middleware"
  10. "gitea.com/go-chi/binding"
  11. )
  12. // ________ .__ __ .__
  13. // \_____ \_______ _________ ____ |__|____________ _/ |_|__| ____ ____
  14. // / | \_ __ \/ ___\__ \ / \| \___ /\__ \\ __\ |/ _ \ / \
  15. // / | \ | \/ /_/ > __ \| | \ |/ / / __ \| | | ( <_> ) | \
  16. // \_______ /__| \___ (____ /___| /__/_____ \(____ /__| |__|\____/|___| /
  17. // \/ /_____/ \/ \/ \/ \/ \/
  18. // CreateOrgForm form for creating organization
  19. type CreateOrgForm struct {
  20. OrgName string `binding:"Required;Username;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(req *http.Request, errs binding.Errors) binding.Errors {
  26. ctx := context.GetContext(req)
  27. return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
  28. }
  29. // UpdateOrgSettingForm form for updating organization settings
  30. type UpdateOrgSettingForm struct {
  31. Name string `binding:"Required;Username;MaxSize(40)" locale:"org.org_name_holder"`
  32. FullName string `binding:"MaxSize(100)"`
  33. Description string `binding:"MaxSize(255)"`
  34. Website string `binding:"ValidUrl;MaxSize(255)"`
  35. Location string `binding:"MaxSize(50)"`
  36. Visibility structs.VisibleType
  37. MaxRepoCreation int
  38. RepoAdminChangeTeamAccess bool
  39. }
  40. // Validate validates the fields
  41. func (f *UpdateOrgSettingForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
  42. ctx := context.GetContext(req)
  43. return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
  44. }
  45. // ___________
  46. // \__ ___/___ _____ _____
  47. // | |_/ __ \\__ \ / \
  48. // | |\ ___/ / __ \| Y Y \
  49. // |____| \___ >____ /__|_| /
  50. // \/ \/ \/
  51. // CreateTeamForm form for creating team
  52. type CreateTeamForm struct {
  53. TeamName string `binding:"Required;AlphaDashDot;MaxSize(30)"`
  54. Description string `binding:"MaxSize(255)"`
  55. Permission string
  56. RepoAccess string
  57. CanCreateOrgRepo bool
  58. }
  59. // Validate validates the fields
  60. func (f *CreateTeamForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
  61. ctx := context.GetContext(req)
  62. return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
  63. }