UserDto.cs 5.4 KB

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