UserPolicy.cs 5.1 KB

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