Pārlūkot izejas kodu

Document various classes.

Patrick Barron 5 gadi atpakaļ
vecāks
revīzija
292993d8ef

+ 17 - 6
Jellyfin.Data/Entities/Preference.cs

@@ -35,30 +35,42 @@ namespace Jellyfin.Data.Entities
          *************************************************************************/
          *************************************************************************/
 
 
         /// <summary>
         /// <summary>
-        /// Identity, Indexed, Required
+        /// Gets or sets the id of this preference.
         /// </summary>
         /// </summary>
+        /// <remarks>
+        /// Identity, Indexed, Required.
+        /// </remarks>
         [Key]
         [Key]
         [Required]
         [Required]
         [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
         [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
         public int Id { get; protected set; }
         public int Id { get; protected set; }
 
 
         /// <summary>
         /// <summary>
-        /// Required
+        /// Gets or sets the type of this preference.
         /// </summary>
         /// </summary>
+        /// <remarks>
+        /// Required.
+        /// </remarks>
         [Required]
         [Required]
-        public PreferenceKind Kind { get; set; }
+        public PreferenceKind Kind { get; protected set; }
 
 
         /// <summary>
         /// <summary>
-        /// Required, Max length = 65535
+        /// Gets or sets the value of this preference.
         /// </summary>
         /// </summary>
+        /// <remarks>
+        /// Required, Max length = 65535.
+        /// </remarks>
         [Required]
         [Required]
         [MaxLength(65535)]
         [MaxLength(65535)]
         [StringLength(65535)]
         [StringLength(65535)]
         public string Value { get; set; }
         public string Value { get; set; }
 
 
         /// <summary>
         /// <summary>
-        /// Required, ConcurrencyToken.
+        /// Gets or sets the row version.
         /// </summary>
         /// </summary>
+        /// <remarks>
+        /// Required, ConcurrencyToken.
+        /// </remarks>
         [ConcurrencyCheck]
         [ConcurrencyCheck]
         [Required]
         [Required]
         public uint RowVersion { get; set; }
         public uint RowVersion { get; set; }
@@ -81,4 +93,3 @@ namespace Jellyfin.Data.Entities
         }
         }
     }
     }
 }
 }
-

+ 86 - 0
Jellyfin.Data/Enums/PermissionKind.cs

@@ -1,27 +1,113 @@
 namespace Jellyfin.Data.Enums
 namespace Jellyfin.Data.Enums
 {
 {
+    /// <summary>
+    /// The types of user permissions.
+    /// </summary>
     public enum PermissionKind
     public enum PermissionKind
     {
     {
+        /// <summary>
+        /// Whether the user is an administrator.
+        /// </summary>
         IsAdministrator,
         IsAdministrator,
+
+        /// <summary>
+        /// Whether the user is hidden.
+        /// </summary>
         IsHidden,
         IsHidden,
+
+        /// <summary>
+        /// Whether the user is disabled.
+        /// </summary>
         IsDisabled,
         IsDisabled,
+
+        /// <summary>
+        /// Whether the user can control shared devices.
+        /// </summary>
         EnableSharedDeviceControl,
         EnableSharedDeviceControl,
+
+        /// <summary>
+        /// Whether the user can access the server remotely.
+        /// </summary>
         EnableRemoteAccess,
         EnableRemoteAccess,
+
+        /// <summary>
+        /// Whether the user can manage live tv.
+        /// </summary>
         EnableLiveTvManagement,
         EnableLiveTvManagement,
+
+        /// <summary>
+        /// Whether the user can access live tv.
+        /// </summary>
         EnableLiveTvAccess,
         EnableLiveTvAccess,
+
+        /// <summary>
+        /// Whether the user can play media.
+        /// </summary>
         EnableMediaPlayback,
         EnableMediaPlayback,
+
+        /// <summary>
+        /// Whether the server should transcode audio for the user if requested.
+        /// </summary>
         EnableAudioPlaybackTranscoding,
         EnableAudioPlaybackTranscoding,
+
+        /// <summary>
+        /// Whether the server should transcode video for the user if requested.
+        /// </summary>
         EnableVideoPlaybackTranscoding,
         EnableVideoPlaybackTranscoding,
+
+        /// <summary>
+        /// Whether the user can delete content.
+        /// </summary>
         EnableContentDeletion,
         EnableContentDeletion,
+
+        /// <summary>
+        /// Whether the user can download content.
+        /// </summary>
         EnableContentDownloading,
         EnableContentDownloading,
+
+        /// <summary>
+        /// Whether to enable sync transcoding for the user.
+        /// </summary>
         EnableSyncTranscoding,
         EnableSyncTranscoding,
+
+        /// <summary>
+        /// Whether the user can do media conversion.
+        /// </summary>
         EnableMediaConversion,
         EnableMediaConversion,
+
+        /// <summary>
+        /// Whether the user has access to all devices.
+        /// </summary>
         EnableAllDevices,
         EnableAllDevices,
+
+        /// <summary>
+        /// Whether the user has access to all channels.
+        /// </summary>
         EnableAllChannels,
         EnableAllChannels,
+
+        /// <summary>
+        /// Whether the user has access to all folders.
+        /// </summary>
         EnableAllFolders,
         EnableAllFolders,
+
+        /// <summary>
+        /// Whether to enable public sharing for the user.
+        /// </summary>
         EnablePublicSharing,
         EnablePublicSharing,
+
+        /// <summary>
+        /// Whether the user can remotely control other users.
+        /// </summary>
         EnableRemoteControlOfOtherUsers,
         EnableRemoteControlOfOtherUsers,
+
+        /// <summary>
+        /// Whether the user is permitted to do playback remuxing.
+        /// </summary>
         EnablePlaybackRemuxing,
         EnablePlaybackRemuxing,
+
+        /// <summary>
+        /// Whether the server should force transcoding on remote connections for the user.
+        /// </summary>
         ForceRemoteSourceTranscoding
         ForceRemoteSourceTranscoding
     }
     }
 }
 }

+ 50 - 0
Jellyfin.Data/Enums/PreferenceKind.cs

@@ -1,18 +1,68 @@
 namespace Jellyfin.Data.Enums
 namespace Jellyfin.Data.Enums
 {
 {
+    /// <summary>
+    /// The types of user preferences.
+    /// </summary>
     public enum PreferenceKind
     public enum PreferenceKind
     {
     {
+        /// <summary>
+        /// A list of blocked tags.
+        /// </summary>
         BlockedTags,
         BlockedTags,
+
+        /// <summary>
+        /// A list of blocked channels.
+        /// </summary>
         BlockedChannels,
         BlockedChannels,
+
+        /// <summary>
+        /// A list of blocked media folders.
+        /// </summary>
         BlockedMediaFolders,
         BlockedMediaFolders,
+
+        /// <summary>
+        /// A list of enabled devices.
+        /// </summary>
         EnabledDevices,
         EnabledDevices,
+
+        /// <summary>
+        /// A list of enabled channels
+        /// </summary>
         EnabledChannels,
         EnabledChannels,
+
+        /// <summary>
+        /// A list of enabled folders.
+        /// </summary>
         EnabledFolders,
         EnabledFolders,
+
+        /// <summary>
+        /// A list of folders to allow content deletion from.
+        /// </summary>
         EnableContentDeletionFromFolders,
         EnableContentDeletionFromFolders,
+
+        /// <summary>
+        /// A list of latest items to exclude.
+        /// </summary>
         LatestItemExcludes,
         LatestItemExcludes,
+
+        /// <summary>
+        /// A list of media to exclude.
+        /// </summary>
         MyMediaExcludes,
         MyMediaExcludes,
+
+        /// <summary>
+        /// A list of grouped folders.
+        /// </summary>
         GroupedFolders,
         GroupedFolders,
+
+        /// <summary>
+        /// A list of unrated items to block.
+        /// </summary>
         BlockUnratedItems,
         BlockUnratedItems,
+
+        /// <summary>
+        /// A list of ordered views.
+        /// </summary>
         OrderedViews
         OrderedViews
     }
     }
 }
 }

+ 37 - 1
Jellyfin.Server.Implementations/Users/UserManager.cs

@@ -1,5 +1,4 @@
 #pragma warning disable CA1307
 #pragma warning disable CA1307
-#pragma warning disable CS1591
 
 
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
@@ -26,6 +25,9 @@ using Microsoft.Extensions.Logging;
 
 
 namespace Jellyfin.Server.Implementations.Users
 namespace Jellyfin.Server.Implementations.Users
 {
 {
+    /// <summary>
+    /// Manages the creation and retrieval of <see cref="User"/> instances.
+    /// </summary>
     public class UserManager : IUserManager
     public class UserManager : IUserManager
     {
     {
         private readonly JellyfinDbProvider _dbProvider;
         private readonly JellyfinDbProvider _dbProvider;
@@ -41,6 +43,15 @@ namespace Jellyfin.Server.Implementations.Users
         private IPasswordResetProvider[] _passwordResetProviders;
         private IPasswordResetProvider[] _passwordResetProviders;
         private DefaultPasswordResetProvider _defaultPasswordResetProvider;
         private DefaultPasswordResetProvider _defaultPasswordResetProvider;
 
 
+        /// <summary>
+        /// Initializes a new instance of the <see cref="UserManager"/> class.
+        /// </summary>
+        /// <param name="dbProvider">The database provider.</param>
+        /// <param name="cryptoProvider">The cryptography provider.</param>
+        /// <param name="networkManager">The network manager.</param>
+        /// <param name="appHost">The application host.</param>
+        /// <param name="imageProcessor">The image processor.</param>
+        /// <param name="logger">The logger.</param>
         public UserManager(
         public UserManager(
             JellyfinDbProvider dbProvider,
             JellyfinDbProvider dbProvider,
             ICryptoProvider cryptoProvider,
             ICryptoProvider cryptoProvider,
@@ -57,6 +68,7 @@ namespace Jellyfin.Server.Implementations.Users
             _logger = logger;
             _logger = logger;
         }
         }
 
 
+        /// <inheritdoc/>
         public event EventHandler<GenericEventArgs<User>> OnUserPasswordChanged;
         public event EventHandler<GenericEventArgs<User>> OnUserPasswordChanged;
 
 
         /// <inheritdoc/>
         /// <inheritdoc/>
@@ -68,8 +80,10 @@ namespace Jellyfin.Server.Implementations.Users
         /// <inheritdoc/>
         /// <inheritdoc/>
         public event EventHandler<GenericEventArgs<User>> OnUserDeleted;
         public event EventHandler<GenericEventArgs<User>> OnUserDeleted;
 
 
+        /// <inheritdoc/>
         public event EventHandler<GenericEventArgs<User>> OnUserLockedOut;
         public event EventHandler<GenericEventArgs<User>> OnUserLockedOut;
 
 
+        /// <inheritdoc/>
         public IEnumerable<User> Users
         public IEnumerable<User> Users
         {
         {
             get
             get
@@ -79,6 +93,7 @@ namespace Jellyfin.Server.Implementations.Users
             }
             }
         }
         }
 
 
+        /// <inheritdoc/>
         public IEnumerable<Guid> UsersIds
         public IEnumerable<Guid> UsersIds
         {
         {
             get
             get
@@ -88,6 +103,7 @@ namespace Jellyfin.Server.Implementations.Users
             }
             }
         }
         }
 
 
+        /// <inheritdoc/>
         public User GetUserById(Guid id)
         public User GetUserById(Guid id)
         {
         {
             if (id == Guid.Empty)
             if (id == Guid.Empty)
@@ -100,6 +116,7 @@ namespace Jellyfin.Server.Implementations.Users
             return dbContext.Users.Find(id);
             return dbContext.Users.Find(id);
         }
         }
 
 
+        /// <inheritdoc/>
         public User GetUserByName(string name)
         public User GetUserByName(string name)
         {
         {
             if (string.IsNullOrWhiteSpace(name))
             if (string.IsNullOrWhiteSpace(name))
@@ -114,6 +131,7 @@ namespace Jellyfin.Server.Implementations.Users
             return dbContext.Users.FirstOrDefault(u => string.Equals(u.Username, name));
             return dbContext.Users.FirstOrDefault(u => string.Equals(u.Username, name));
         }
         }
 
 
+        /// <inheritdoc/>
         public async Task RenameUser(User user, string newName)
         public async Task RenameUser(User user, string newName)
         {
         {
             if (user == null)
             if (user == null)
@@ -145,6 +163,7 @@ namespace Jellyfin.Server.Implementations.Users
             OnUserUpdated?.Invoke(this, new GenericEventArgs<User>(user));
             OnUserUpdated?.Invoke(this, new GenericEventArgs<User>(user));
         }
         }
 
 
+        /// <inheritdoc/>
         public void UpdateUser(User user)
         public void UpdateUser(User user)
         {
         {
             var dbContext = _dbProvider.CreateContext();
             var dbContext = _dbProvider.CreateContext();
@@ -152,6 +171,7 @@ namespace Jellyfin.Server.Implementations.Users
             dbContext.SaveChanges();
             dbContext.SaveChanges();
         }
         }
 
 
+        /// <inheritdoc/>
         public async Task UpdateUserAsync(User user)
         public async Task UpdateUserAsync(User user)
         {
         {
             var dbContext = _dbProvider.CreateContext();
             var dbContext = _dbProvider.CreateContext();
@@ -160,6 +180,7 @@ namespace Jellyfin.Server.Implementations.Users
             await dbContext.SaveChangesAsync().ConfigureAwait(false);
             await dbContext.SaveChangesAsync().ConfigureAwait(false);
         }
         }
 
 
+        /// <inheritdoc/>
         public User CreateUser(string name)
         public User CreateUser(string name)
         {
         {
             if (!IsValidUsername(name))
             if (!IsValidUsername(name))
@@ -178,6 +199,7 @@ namespace Jellyfin.Server.Implementations.Users
             return newUser;
             return newUser;
         }
         }
 
 
+        /// <inheritdoc/>
         public void DeleteUser(User user)
         public void DeleteUser(User user)
         {
         {
             if (user == null)
             if (user == null)
@@ -220,16 +242,19 @@ namespace Jellyfin.Server.Implementations.Users
             OnUserDeleted?.Invoke(this, new GenericEventArgs<User>(user));
             OnUserDeleted?.Invoke(this, new GenericEventArgs<User>(user));
         }
         }
 
 
+        /// <inheritdoc/>
         public Task ResetPassword(User user)
         public Task ResetPassword(User user)
         {
         {
             return ChangePassword(user, string.Empty);
             return ChangePassword(user, string.Empty);
         }
         }
 
 
+        /// <inheritdoc/>
         public void ResetEasyPassword(User user)
         public void ResetEasyPassword(User user)
         {
         {
             ChangeEasyPassword(user, string.Empty, null);
             ChangeEasyPassword(user, string.Empty, null);
         }
         }
 
 
+        /// <inheritdoc/>
         public async Task ChangePassword(User user, string newPassword)
         public async Task ChangePassword(User user, string newPassword)
         {
         {
             if (user == null)
             if (user == null)
@@ -243,6 +268,7 @@ namespace Jellyfin.Server.Implementations.Users
             OnUserPasswordChanged?.Invoke(this, new GenericEventArgs<User>(user));
             OnUserPasswordChanged?.Invoke(this, new GenericEventArgs<User>(user));
         }
         }
 
 
+        /// <inheritdoc/>
         public void ChangeEasyPassword(User user, string newPassword, string newPasswordSha1)
         public void ChangeEasyPassword(User user, string newPassword, string newPasswordSha1)
         {
         {
             GetAuthenticationProvider(user).ChangeEasyPassword(user, newPassword, newPasswordSha1);
             GetAuthenticationProvider(user).ChangeEasyPassword(user, newPassword, newPasswordSha1);
@@ -251,6 +277,7 @@ namespace Jellyfin.Server.Implementations.Users
             OnUserPasswordChanged?.Invoke(this, new GenericEventArgs<User>(user));
             OnUserPasswordChanged?.Invoke(this, new GenericEventArgs<User>(user));
         }
         }
 
 
+        /// <inheritdoc/>
         public UserDto GetUserDto(User user, string remoteEndPoint = null)
         public UserDto GetUserDto(User user, string remoteEndPoint = null)
         {
         {
             return new UserDto
             return new UserDto
@@ -321,6 +348,7 @@ namespace Jellyfin.Server.Implementations.Users
             };
             };
         }
         }
 
 
+        /// <inheritdoc/>
         public PublicUserDto GetPublicUserDto(User user, string remoteEndPoint = null)
         public PublicUserDto GetPublicUserDto(User user, string remoteEndPoint = null)
         {
         {
             if (user == null)
             if (user == null)
@@ -343,6 +371,7 @@ namespace Jellyfin.Server.Implementations.Users
             };
             };
         }
         }
 
 
+        /// <inheritdoc/>
         public async Task<User> AuthenticateUser(
         public async Task<User> AuthenticateUser(
             string username,
             string username,
             string password,
             string password,
@@ -469,6 +498,7 @@ namespace Jellyfin.Server.Implementations.Users
             return success ? user : null;
             return success ? user : null;
         }
         }
 
 
+        /// <inheritdoc/>
         public async Task<ForgotPasswordResult> StartForgotPasswordProcess(string enteredUsername, bool isInNetwork)
         public async Task<ForgotPasswordResult> StartForgotPasswordProcess(string enteredUsername, bool isInNetwork)
         {
         {
             var user = string.IsNullOrWhiteSpace(enteredUsername) ? null : GetUserByName(enteredUsername);
             var user = string.IsNullOrWhiteSpace(enteredUsername) ? null : GetUserByName(enteredUsername);
@@ -488,6 +518,7 @@ namespace Jellyfin.Server.Implementations.Users
             };
             };
         }
         }
 
 
+        /// <inheritdoc/>
         public async Task<PinRedeemResult> RedeemPasswordResetPin(string pin)
         public async Task<PinRedeemResult> RedeemPasswordResetPin(string pin)
         {
         {
             foreach (var provider in _passwordResetProviders)
             foreach (var provider in _passwordResetProviders)
@@ -507,6 +538,7 @@ namespace Jellyfin.Server.Implementations.Users
             };
             };
         }
         }
 
 
+        /// <inheritdoc/>
         public void AddParts(IEnumerable<IAuthenticationProvider> authenticationProviders, IEnumerable<IPasswordResetProvider> passwordResetProviders)
         public void AddParts(IEnumerable<IAuthenticationProvider> authenticationProviders, IEnumerable<IPasswordResetProvider> passwordResetProviders)
         {
         {
             _authenticationProviders = authenticationProviders.ToArray();
             _authenticationProviders = authenticationProviders.ToArray();
@@ -517,6 +549,7 @@ namespace Jellyfin.Server.Implementations.Users
             _defaultPasswordResetProvider = _passwordResetProviders.OfType<DefaultPasswordResetProvider>().First();
             _defaultPasswordResetProvider = _passwordResetProviders.OfType<DefaultPasswordResetProvider>().First();
         }
         }
 
 
+        /// <inheritdoc/>
         public NameIdPair[] GetAuthenticationProviders()
         public NameIdPair[] GetAuthenticationProviders()
         {
         {
             return _authenticationProviders
             return _authenticationProviders
@@ -531,6 +564,7 @@ namespace Jellyfin.Server.Implementations.Users
                 .ToArray();
                 .ToArray();
         }
         }
 
 
+        /// <inheritdoc/>
         public NameIdPair[] GetPasswordResetProviders()
         public NameIdPair[] GetPasswordResetProviders()
         {
         {
             return _passwordResetProviders
             return _passwordResetProviders
@@ -545,6 +579,7 @@ namespace Jellyfin.Server.Implementations.Users
                 .ToArray();
                 .ToArray();
         }
         }
 
 
+        /// <inheritdoc/>
         public void UpdateConfiguration(Guid userId, UserConfiguration config)
         public void UpdateConfiguration(Guid userId, UserConfiguration config)
         {
         {
             var user = GetUserById(userId);
             var user = GetUserById(userId);
@@ -568,6 +603,7 @@ namespace Jellyfin.Server.Implementations.Users
             UpdateUser(user);
             UpdateUser(user);
         }
         }
 
 
+        /// <inheritdoc/>
         public void UpdatePolicy(Guid userId, UserPolicy policy)
         public void UpdatePolicy(Guid userId, UserPolicy policy)
         {
         {
             var user = GetUserById(userId);
             var user = GetUserById(userId);