gitea源码

admin_user.go 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // Copyright 2015 The Gogs Authors. All rights reserved.
  2. // Copyright 2019 The Gitea Authors. All rights reserved.
  3. // SPDX-License-Identifier: MIT
  4. package structs
  5. import "time"
  6. // CreateUserOption create user options
  7. type CreateUserOption struct {
  8. // The authentication source ID to associate with the user
  9. SourceID int64 `json:"source_id"`
  10. // identifier of the user, provided by the external authenticator (if configured)
  11. // default: empty
  12. LoginName string `json:"login_name"`
  13. // username of the user
  14. // required: true
  15. Username string `json:"username" binding:"Required;Username;MaxSize(40)"`
  16. // The full display name of the user
  17. FullName string `json:"full_name" binding:"MaxSize(100)"`
  18. // required: true
  19. // swagger:strfmt email
  20. Email string `json:"email" binding:"Required;Email;MaxSize(254)"`
  21. // The plain text password for the user
  22. Password string `json:"password" binding:"MaxSize(255)"`
  23. // Whether the user must change password on first login
  24. MustChangePassword *bool `json:"must_change_password"`
  25. // Whether to send welcome notification email to the user
  26. SendNotify bool `json:"send_notify"`
  27. // Whether the user has restricted access privileges
  28. Restricted *bool `json:"restricted"`
  29. // User visibility level: public, limited, or private
  30. Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
  31. // For explicitly setting the user creation timestamp. Useful when users are
  32. // migrated from other systems. When omitted, the user's creation timestamp
  33. // will be set to "now".
  34. Created *time.Time `json:"created_at"`
  35. }
  36. // EditUserOption edit user options
  37. type EditUserOption struct {
  38. // required: true
  39. // The authentication source ID to associate with the user
  40. SourceID int64 `json:"source_id"`
  41. // identifier of the user, provided by the external authenticator (if configured)
  42. // default: empty
  43. // required: true
  44. LoginName string `json:"login_name" binding:"Required"`
  45. // swagger:strfmt email
  46. // The email address of the user
  47. Email *string `json:"email" binding:"MaxSize(254)"`
  48. // The full display name of the user
  49. FullName *string `json:"full_name" binding:"MaxSize(100)"`
  50. // The plain text password for the user
  51. Password string `json:"password" binding:"MaxSize(255)"`
  52. // Whether the user must change password on next login
  53. MustChangePassword *bool `json:"must_change_password"`
  54. // The user's personal website URL
  55. Website *string `json:"website" binding:"OmitEmpty;ValidUrl;MaxSize(255)"`
  56. // The user's location or address
  57. Location *string `json:"location" binding:"MaxSize(50)"`
  58. // The user's personal description or bio
  59. Description *string `json:"description" binding:"MaxSize(255)"`
  60. // Whether the user account is active
  61. Active *bool `json:"active"`
  62. // Whether the user has administrator privileges
  63. Admin *bool `json:"admin"`
  64. // Whether the user can use Git hooks
  65. AllowGitHook *bool `json:"allow_git_hook"`
  66. // Whether the user can import local repositories
  67. AllowImportLocal *bool `json:"allow_import_local"`
  68. // Maximum number of repositories the user can create
  69. MaxRepoCreation *int `json:"max_repo_creation"`
  70. // Whether the user is prohibited from logging in
  71. ProhibitLogin *bool `json:"prohibit_login"`
  72. // Whether the user can create organizations
  73. AllowCreateOrganization *bool `json:"allow_create_organization"`
  74. // Whether the user has restricted access privileges
  75. Restricted *bool `json:"restricted"`
  76. // User visibility level: public, limited, or private
  77. Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
  78. }