UserDto.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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 connect user.
  29. /// </summary>
  30. /// <value>The name of the connect user.</value>
  31. public string ConnectUserName { get; set; }
  32. /// <summary>
  33. /// Gets or sets the connect user identifier.
  34. /// </summary>
  35. /// <value>The connect user identifier.</value>
  36. public string ConnectUserId { get; set; }
  37. /// <summary>
  38. /// Gets or sets the type of the connect link.
  39. /// </summary>
  40. /// <value>The type of the connect link.</value>
  41. public UserLinkType? ConnectLinkType { get; set; }
  42. /// <summary>
  43. /// Gets or sets the id.
  44. /// </summary>
  45. /// <value>The id.</value>
  46. public string Id { get; set; }
  47. /// <summary>
  48. /// Gets or sets the primary image tag.
  49. /// </summary>
  50. /// <value>The primary image tag.</value>
  51. public string PrimaryImageTag { get; set; }
  52. /// <summary>
  53. /// Gets or sets a value indicating whether this instance has password.
  54. /// </summary>
  55. /// <value><c>true</c> if this instance has password; otherwise, <c>false</c>.</value>
  56. public bool HasPassword { get; set; }
  57. /// <summary>
  58. /// Gets or sets a value indicating whether this instance has configured password.
  59. /// </summary>
  60. /// <value><c>true</c> if this instance has configured password; otherwise, <c>false</c>.</value>
  61. public bool HasConfiguredPassword { get; set; }
  62. /// <summary>
  63. /// Gets or sets the last login date.
  64. /// </summary>
  65. /// <value>The last login date.</value>
  66. public DateTime? LastLoginDate { get; set; }
  67. /// <summary>
  68. /// Gets or sets the last activity date.
  69. /// </summary>
  70. /// <value>The last activity date.</value>
  71. public DateTime? LastActivityDate { get; set; }
  72. /// <summary>
  73. /// Gets or sets the configuration.
  74. /// </summary>
  75. /// <value>The configuration.</value>
  76. public UserConfiguration Configuration { get; set; }
  77. /// <summary>
  78. /// Gets or sets the policy.
  79. /// </summary>
  80. /// <value>The policy.</value>
  81. public UserPolicy Policy { get; set; }
  82. /// <summary>
  83. /// Gets or sets the primary image aspect ratio.
  84. /// </summary>
  85. /// <value>The primary image aspect ratio.</value>
  86. public double? PrimaryImageAspectRatio { get; set; }
  87. /// <summary>
  88. /// Gets or sets the original primary image aspect ratio.
  89. /// </summary>
  90. /// <value>The original primary image aspect ratio.</value>
  91. public double? OriginalPrimaryImageAspectRatio { get; set; }
  92. /// <summary>
  93. /// Gets a value indicating whether this instance has primary image.
  94. /// </summary>
  95. /// <value><c>true</c> if this instance has primary image; otherwise, <c>false</c>.</value>
  96. [IgnoreDataMember]
  97. public bool HasPrimaryImage
  98. {
  99. get { return PrimaryImageTag != null; }
  100. }
  101. /// <summary>
  102. /// Initializes a new instance of the <see cref="UserDto"/> class.
  103. /// </summary>
  104. public UserDto()
  105. {
  106. Configuration = new UserConfiguration();
  107. Policy = new UserPolicy();
  108. }
  109. /// <summary>
  110. /// Occurs when [property changed].
  111. /// </summary>
  112. public event PropertyChangedEventHandler PropertyChanged;
  113. public override string ToString()
  114. {
  115. return Name ?? base.ToString();
  116. }
  117. }
  118. }