UserPolicy.cs 5.7 KB

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