UserPolicy.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. #nullable disable
  2. #pragma warning disable CS1591, CA1819
  3. using System;
  4. using System.ComponentModel;
  5. using System.ComponentModel.DataAnnotations;
  6. using System.Xml.Serialization;
  7. using Jellyfin.Data.Enums;
  8. using Jellyfin.Database.Implementations.Enums;
  9. using AccessSchedule = Jellyfin.Database.Implementations.Entities.AccessSchedule;
  10. namespace MediaBrowser.Model.Users
  11. {
  12. public class UserPolicy
  13. {
  14. public UserPolicy()
  15. {
  16. IsHidden = true;
  17. EnableCollectionManagement = false;
  18. EnableSubtitleManagement = false;
  19. EnableContentDeletion = false;
  20. EnableContentDeletionFromFolders = Array.Empty<string>();
  21. EnableSyncTranscoding = true;
  22. EnableMediaConversion = true;
  23. EnableMediaPlayback = true;
  24. EnableAudioPlaybackTranscoding = true;
  25. EnableVideoPlaybackTranscoding = true;
  26. EnablePlaybackRemuxing = true;
  27. ForceRemoteSourceTranscoding = false;
  28. EnableLiveTvManagement = true;
  29. EnableLiveTvAccess = true;
  30. // Without this on by default, admins won't be able to do this
  31. // Improve in the future
  32. EnableLiveTvManagement = true;
  33. EnableSharedDeviceControl = true;
  34. BlockedTags = Array.Empty<string>();
  35. AllowedTags = Array.Empty<string>();
  36. BlockUnratedItems = Array.Empty<UnratedItem>();
  37. EnableUserPreferenceAccess = true;
  38. AccessSchedules = Array.Empty<AccessSchedule>();
  39. LoginAttemptsBeforeLockout = -1;
  40. MaxActiveSessions = 0;
  41. MaxParentalRating = null;
  42. EnableAllChannels = true;
  43. EnabledChannels = Array.Empty<Guid>();
  44. EnableAllFolders = true;
  45. EnabledFolders = Array.Empty<Guid>();
  46. EnabledDevices = Array.Empty<string>();
  47. EnableAllDevices = true;
  48. EnableContentDownloading = true;
  49. EnablePublicSharing = true;
  50. EnableRemoteAccess = true;
  51. SyncPlayAccess = SyncPlayUserAccessType.CreateAndJoinGroups;
  52. }
  53. /// <summary>
  54. /// Gets or sets a value indicating whether this instance is administrator.
  55. /// </summary>
  56. /// <value><c>true</c> if this instance is administrator; otherwise, <c>false</c>.</value>
  57. public bool IsAdministrator { get; set; }
  58. /// <summary>
  59. /// Gets or sets a value indicating whether this instance is hidden.
  60. /// </summary>
  61. /// <value><c>true</c> if this instance is hidden; otherwise, <c>false</c>.</value>
  62. public bool IsHidden { get; set; }
  63. /// <summary>
  64. /// Gets or sets a value indicating whether this instance can manage collections.
  65. /// </summary>
  66. /// <value><c>true</c> if this instance is hidden; otherwise, <c>false</c>.</value>
  67. [DefaultValue(false)]
  68. public bool EnableCollectionManagement { get; set; }
  69. /// <summary>
  70. /// Gets or sets a value indicating whether this instance can manage subtitles.
  71. /// </summary>
  72. /// <value><c>true</c> if this instance is allowed; otherwise, <c>false</c>.</value>
  73. [DefaultValue(false)]
  74. public bool EnableSubtitleManagement { get; set; }
  75. /// <summary>
  76. /// Gets or sets a value indicating whether this user can manage lyrics.
  77. /// </summary>
  78. [DefaultValue(false)]
  79. public bool EnableLyricManagement { get; set; }
  80. /// <summary>
  81. /// Gets or sets a value indicating whether this instance is disabled.
  82. /// </summary>
  83. /// <value><c>true</c> if this instance is disabled; otherwise, <c>false</c>.</value>
  84. public bool IsDisabled { get; set; }
  85. /// <summary>
  86. /// Gets or sets the max parental rating.
  87. /// </summary>
  88. /// <value>The max parental rating.</value>
  89. public int? MaxParentalRating { get; set; }
  90. public int? MaxParentalSubRating { get; set; }
  91. public string[] BlockedTags { get; set; }
  92. public string[] AllowedTags { get; set; }
  93. public bool EnableUserPreferenceAccess { get; set; }
  94. public AccessSchedule[] AccessSchedules { get; set; }
  95. public UnratedItem[] BlockUnratedItems { get; set; }
  96. public bool EnableRemoteControlOfOtherUsers { get; set; }
  97. public bool EnableSharedDeviceControl { get; set; }
  98. public bool EnableRemoteAccess { get; set; }
  99. public bool EnableLiveTvManagement { get; set; }
  100. public bool EnableLiveTvAccess { get; set; }
  101. public bool EnableMediaPlayback { get; set; }
  102. public bool EnableAudioPlaybackTranscoding { get; set; }
  103. public bool EnableVideoPlaybackTranscoding { get; set; }
  104. public bool EnablePlaybackRemuxing { get; set; }
  105. public bool ForceRemoteSourceTranscoding { get; set; }
  106. public bool EnableContentDeletion { get; set; }
  107. public string[] EnableContentDeletionFromFolders { get; set; }
  108. public bool EnableContentDownloading { get; set; }
  109. /// <summary>
  110. /// Gets or sets a value indicating whether [enable synchronize].
  111. /// </summary>
  112. /// <value><c>true</c> if [enable synchronize]; otherwise, <c>false</c>.</value>
  113. public bool EnableSyncTranscoding { get; set; }
  114. public bool EnableMediaConversion { get; set; }
  115. public string[] EnabledDevices { get; set; }
  116. public bool EnableAllDevices { get; set; }
  117. public Guid[] EnabledChannels { get; set; }
  118. public bool EnableAllChannels { get; set; }
  119. public Guid[] EnabledFolders { get; set; }
  120. public bool EnableAllFolders { get; set; }
  121. public int InvalidLoginAttemptCount { get; set; }
  122. public int LoginAttemptsBeforeLockout { get; set; }
  123. public int MaxActiveSessions { get; set; }
  124. public bool EnablePublicSharing { get; set; }
  125. public Guid[] BlockedMediaFolders { get; set; }
  126. public Guid[] BlockedChannels { get; set; }
  127. public int RemoteClientBitrateLimit { get; set; }
  128. [XmlElement(ElementName = "AuthenticationProviderId")]
  129. [Required(AllowEmptyStrings = false)]
  130. public string AuthenticationProviderId { get; set; }
  131. [Required(AllowEmptyStrings= false)]
  132. public string PasswordResetProviderId { get; set; }
  133. /// <summary>
  134. /// Gets or sets a value indicating what SyncPlay features the user can access.
  135. /// </summary>
  136. /// <value>Access level to SyncPlay features.</value>
  137. public SyncPlayUserAccessType SyncPlayAccess { get; set; }
  138. }
  139. }