UserPolicy.cs 6.4 KB

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