UserDto.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. using MediaBrowser.Model.Configuration;
  2. using MediaBrowser.Model.Connect;
  3. using MediaBrowser.Model.Users;
  4. using System;
  5. using System.Diagnostics;
  6. using System.Runtime.Serialization;
  7. namespace MediaBrowser.Model.Dto
  8. {
  9. /// <summary>
  10. /// Class UserDto
  11. /// </summary>
  12. [DebuggerDisplay("Name = {Name}, ID = {Id}, HasPassword = {HasPassword}")]
  13. public class UserDto : IItemDto, IHasServerId
  14. {
  15. /// <summary>
  16. /// Gets or sets the name.
  17. /// </summary>
  18. /// <value>The name.</value>
  19. public string Name { get; set; }
  20. /// <summary>
  21. /// Gets or sets the server identifier.
  22. /// </summary>
  23. /// <value>The server identifier.</value>
  24. public string ServerId { get; set; }
  25. /// <summary>
  26. /// Gets or sets the name of the server.
  27. /// This is not used by the server and is for client-side usage only.
  28. /// </summary>
  29. /// <value>The name of the server.</value>
  30. public string ServerName { get; set; }
  31. /// <summary>
  32. /// Gets or sets the name of the connect user.
  33. /// </summary>
  34. /// <value>The name of the connect user.</value>
  35. public string ConnectUserName { get; set; }
  36. /// <summary>
  37. /// Gets or sets the connect user identifier.
  38. /// </summary>
  39. /// <value>The connect user identifier.</value>
  40. public string ConnectUserId { get; set; }
  41. /// <summary>
  42. /// Gets or sets the type of the connect link.
  43. /// </summary>
  44. /// <value>The type of the connect link.</value>
  45. public UserLinkType? ConnectLinkType { get; set; }
  46. /// <summary>
  47. /// Gets or sets the id.
  48. /// </summary>
  49. /// <value>The id.</value>
  50. public string Id { get; set; }
  51. /// <summary>
  52. /// Gets or sets the offline password.
  53. /// </summary>
  54. /// <value>The offline password.</value>
  55. public string OfflinePassword { get; set; }
  56. /// <summary>
  57. /// Gets or sets the offline password salt.
  58. /// </summary>
  59. /// <value>The offline password salt.</value>
  60. public string OfflinePasswordSalt { get; set; }
  61. /// <summary>
  62. /// Gets or sets the primary image tag.
  63. /// </summary>
  64. /// <value>The primary image tag.</value>
  65. public string PrimaryImageTag { get; set; }
  66. /// <summary>
  67. /// Gets or sets a value indicating whether this instance has password.
  68. /// </summary>
  69. /// <value><c>true</c> if this instance has password; otherwise, <c>false</c>.</value>
  70. public bool HasPassword { get; set; }
  71. /// <summary>
  72. /// Gets or sets a value indicating whether this instance has configured password.
  73. /// </summary>
  74. /// <value><c>true</c> if this instance has configured password; otherwise, <c>false</c>.</value>
  75. public bool HasConfiguredPassword { get; set; }
  76. /// <summary>
  77. /// Gets or sets a value indicating whether this instance has configured easy password.
  78. /// </summary>
  79. /// <value><c>true</c> if this instance has configured easy password; otherwise, <c>false</c>.</value>
  80. public bool HasConfiguredEasyPassword { get; set; }
  81. /// <summary>
  82. /// Gets or sets the last login date.
  83. /// </summary>
  84. /// <value>The last login date.</value>
  85. public DateTime? LastLoginDate { get; set; }
  86. /// <summary>
  87. /// Gets or sets the last activity date.
  88. /// </summary>
  89. /// <value>The last activity date.</value>
  90. public DateTime? LastActivityDate { get; set; }
  91. /// <summary>
  92. /// Gets or sets the configuration.
  93. /// </summary>
  94. /// <value>The configuration.</value>
  95. public UserConfiguration Configuration { get; set; }
  96. /// <summary>
  97. /// Gets or sets the policy.
  98. /// </summary>
  99. /// <value>The policy.</value>
  100. public UserPolicy Policy { get; set; }
  101. /// <summary>
  102. /// Gets or sets the primary image aspect ratio.
  103. /// </summary>
  104. /// <value>The primary image aspect ratio.</value>
  105. public double? PrimaryImageAspectRatio { get; set; }
  106. /// <summary>
  107. /// Gets a value indicating whether this instance has primary image.
  108. /// </summary>
  109. /// <value><c>true</c> if this instance has primary image; otherwise, <c>false</c>.</value>
  110. [IgnoreDataMember]
  111. public bool HasPrimaryImage
  112. {
  113. get { return PrimaryImageTag != null; }
  114. }
  115. /// <summary>
  116. /// Initializes a new instance of the <see cref="UserDto"/> class.
  117. /// </summary>
  118. public UserDto()
  119. {
  120. Configuration = new UserConfiguration();
  121. Policy = new UserPolicy();
  122. }
  123. public override string ToString()
  124. {
  125. return Name ?? base.ToString();
  126. }
  127. }
  128. }