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