user_auth.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package models
  2. import (
  3. "time"
  4. )
  5. type UserAuth struct {
  6. Id int64
  7. UserId int64
  8. AuthModule string
  9. AuthId string
  10. Created time.Time
  11. }
  12. type ExternalUserInfo struct {
  13. AuthModule string
  14. AuthId string
  15. UserId int64
  16. Email string
  17. Login string
  18. Name string
  19. Groups []string
  20. OrgRoles map[int64]RoleType
  21. IsGrafanaAdmin *bool // This is a pointer to know if we should sync this or not (nil = ignore sync)
  22. }
  23. // ---------------------
  24. // COMMANDS
  25. type UpsertUserCommand struct {
  26. ReqContext *ReqContext
  27. ExternalUser *ExternalUserInfo
  28. SignupAllowed bool
  29. Result *User
  30. }
  31. type SetAuthInfoCommand struct {
  32. AuthModule string
  33. AuthId string
  34. UserId int64
  35. }
  36. type DeleteAuthInfoCommand struct {
  37. UserAuth *UserAuth
  38. }
  39. // ----------------------
  40. // QUERIES
  41. type LoginUserQuery struct {
  42. ReqContext *ReqContext
  43. Username string
  44. Password string
  45. User *User
  46. IpAddress string
  47. }
  48. type GetUserByAuthInfoQuery struct {
  49. AuthModule string
  50. AuthId string
  51. UserId int64
  52. Email string
  53. Login string
  54. Result *User
  55. }
  56. type GetAuthInfoQuery struct {
  57. AuthModule string
  58. AuthId string
  59. Result *UserAuth
  60. }
  61. type SyncTeamsCommand struct {
  62. ExternalUser *ExternalUserInfo
  63. User *User
  64. }