user_auth.go 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. OrgRoles map[int64]RoleType
  20. }
  21. // ---------------------
  22. // COMMANDS
  23. type UpsertUserCommand struct {
  24. ExternalUser *ExternalUserInfo
  25. SignupAllowed bool
  26. Result *User
  27. }
  28. type SetAuthInfoCommand struct {
  29. AuthModule string
  30. AuthId string
  31. UserId int64
  32. }
  33. type DeleteAuthInfoCommand struct {
  34. UserAuth *UserAuth
  35. }
  36. // ----------------------
  37. // QUERIES
  38. type LoginUserQuery struct {
  39. Username string
  40. Password string
  41. User *User
  42. IpAddress string
  43. }
  44. type GetUserByAuthInfoQuery struct {
  45. AuthModule string
  46. AuthId string
  47. UserId int64
  48. Email string
  49. Login string
  50. User *User
  51. UserAuth *UserAuth
  52. }
  53. type GetAuthInfoQuery struct {
  54. AuthModule string
  55. AuthId string
  56. UserAuth *UserAuth
  57. }