gitea源码

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // Copyright 2015 The Gogs Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package structs
  4. // Organization represents an organization
  5. type Organization struct {
  6. // The unique identifier of the organization
  7. ID int64 `json:"id"`
  8. // The name of the organization
  9. Name string `json:"name"`
  10. // The full display name of the organization
  11. FullName string `json:"full_name"`
  12. // The email address of the organization
  13. Email string `json:"email"`
  14. // The URL of the organization's avatar
  15. AvatarURL string `json:"avatar_url"`
  16. // The description of the organization
  17. Description string `json:"description"`
  18. // The website URL of the organization
  19. Website string `json:"website"`
  20. // The location of the organization
  21. Location string `json:"location"`
  22. // The visibility level of the organization (public, limited, private)
  23. Visibility string `json:"visibility"`
  24. // Whether repository administrators can change team access
  25. RepoAdminChangeTeamAccess bool `json:"repo_admin_change_team_access"`
  26. // username of the organization
  27. // deprecated
  28. UserName string `json:"username"`
  29. }
  30. // OrganizationPermissions list different users permissions on an organization
  31. type OrganizationPermissions struct {
  32. // Whether the user is an owner of the organization
  33. IsOwner bool `json:"is_owner"`
  34. // Whether the user is an admin of the organization
  35. IsAdmin bool `json:"is_admin"`
  36. // Whether the user can write to the organization
  37. CanWrite bool `json:"can_write"`
  38. // Whether the user can read the organization
  39. CanRead bool `json:"can_read"`
  40. // Whether the user can create repositories in the organization
  41. CanCreateRepository bool `json:"can_create_repository"`
  42. }
  43. // CreateOrgOption options for creating an organization
  44. type CreateOrgOption struct {
  45. // username of the organization
  46. // required: true
  47. UserName string `json:"username" binding:"Required;Username;MaxSize(40)"`
  48. // The full display name of the organization
  49. FullName string `json:"full_name" binding:"MaxSize(100)"`
  50. // The email address of the organization
  51. Email string `json:"email" binding:"MaxSize(255)"`
  52. // The description of the organization
  53. Description string `json:"description" binding:"MaxSize(255)"`
  54. // The website URL of the organization
  55. Website string `json:"website" binding:"ValidUrl;MaxSize(255)"`
  56. // The location of the organization
  57. Location string `json:"location" binding:"MaxSize(50)"`
  58. // possible values are `public` (default), `limited` or `private`
  59. // enum: public,limited,private
  60. Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
  61. // Whether repository administrators can change team access
  62. RepoAdminChangeTeamAccess bool `json:"repo_admin_change_team_access"`
  63. }
  64. // TODO: make EditOrgOption fields optional after https://gitea.com/go-chi/binding/pulls/5 got merged
  65. // EditOrgOption options for editing an organization
  66. type EditOrgOption struct {
  67. // The full display name of the organization
  68. FullName string `json:"full_name" binding:"MaxSize(100)"`
  69. // The email address of the organization
  70. Email string `json:"email" binding:"MaxSize(255)"`
  71. // The description of the organization
  72. Description string `json:"description" binding:"MaxSize(255)"`
  73. // The website URL of the organization
  74. Website string `json:"website" binding:"ValidUrl;MaxSize(255)"`
  75. // The location of the organization
  76. Location string `json:"location" binding:"MaxSize(50)"`
  77. // possible values are `public`, `limited` or `private`
  78. // enum: public,limited,private
  79. Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
  80. // Whether repository administrators can change team access
  81. RepoAdminChangeTeamAccess *bool `json:"repo_admin_change_team_access"`
  82. }
  83. // RenameOrgOption options when renaming an organization
  84. type RenameOrgOption struct {
  85. // New username for this org. This name cannot be in use yet by any other user.
  86. //
  87. // required: true
  88. // unique: true
  89. NewName string `json:"new_name" binding:"Required"`
  90. }