jellyfin-server/MediaBrowser.Controller/Library/IUserManager.cs

221 lines
8.0 KiB
C#
Raw Normal View History

2014-05-08 20:09:53 +00:00
using MediaBrowser.Controller.Entities;
2014-06-22 05:52:31 +00:00
using MediaBrowser.Model.Configuration;
2014-08-15 16:35:41 +00:00
using MediaBrowser.Model.Dto;
2014-05-08 20:09:53 +00:00
using MediaBrowser.Model.Events;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Users;
namespace MediaBrowser.Controller.Library
{
2013-04-05 19:34:33 +00:00
/// <summary>
/// Interface IUserManager
/// </summary>
public interface IUserManager
{
/// <summary>
/// Gets the users.
/// </summary>
/// <value>The users.</value>
IEnumerable<User> Users { get; }
/// <summary>
/// Occurs when [user updated].
/// </summary>
event EventHandler<GenericEventArgs<User>> UserUpdated;
/// <summary>
/// Occurs when [user deleted].
/// </summary>
event EventHandler<GenericEventArgs<User>> UserDeleted;
2013-07-07 02:01:14 +00:00
event EventHandler<GenericEventArgs<User>> UserCreated;
2014-06-22 05:52:31 +00:00
event EventHandler<GenericEventArgs<User>> UserConfigurationUpdated;
2014-08-10 22:13:17 +00:00
event EventHandler<GenericEventArgs<User>> UserPasswordChanged;
2015-03-02 05:16:29 +00:00
event EventHandler<GenericEventArgs<User>> UserLockedOut;
2014-06-22 05:52:31 +00:00
/// <summary>
/// Gets a User by Id
/// </summary>
/// <param name="id">The id.</param>
/// <returns>User.</returns>
/// <exception cref="System.ArgumentNullException"></exception>
User GetUserById(Guid id);
2014-09-14 15:10:51 +00:00
/// <summary>
/// Gets the user by identifier.
/// </summary>
/// <param name="id">The identifier.</param>
/// <returns>User.</returns>
User GetUserById(string id);
2014-10-14 04:22:17 +00:00
/// <summary>
/// Gets the name of the user by.
/// </summary>
/// <param name="name">The name.</param>
/// <returns>User.</returns>
User GetUserByName(string name);
/// <summary>
/// Authenticates a User and returns a result indicating whether or not it succeeded
/// </summary>
2014-07-02 18:34:08 +00:00
/// <param name="username">The username.</param>
2014-10-14 04:22:17 +00:00
/// <param name="passwordSha1">The password sha1.</param>
2014-08-15 16:35:41 +00:00
/// <param name="remoteEndPoint">The remote end point.</param>
/// <returns>Task{System.Boolean}.</returns>
/// <exception cref="System.ArgumentNullException">user</exception>
2017-04-06 20:07:25 +00:00
Task<User> AuthenticateUser(string username, string passwordSha1, string remoteEndPoint);
2014-08-15 16:35:41 +00:00
/// <summary>
/// Refreshes metadata for each user
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task RefreshUsersMetadata(CancellationToken cancellationToken);
/// <summary>
/// Renames the user.
/// </summary>
/// <param name="user">The user.</param>
/// <param name="newName">The new name.</param>
/// <returns>Task.</returns>
/// <exception cref="System.ArgumentNullException">user</exception>
/// <exception cref="System.ArgumentException"></exception>
Task RenameUser(User user, string newName);
/// <summary>
/// Updates the user.
/// </summary>
/// <param name="user">The user.</param>
/// <exception cref="System.ArgumentNullException">user</exception>
/// <exception cref="System.ArgumentException"></exception>
Task UpdateUser(User user);
/// <summary>
/// Creates the user.
/// </summary>
/// <param name="name">The name.</param>
/// <returns>User.</returns>
/// <exception cref="System.ArgumentNullException">name</exception>
/// <exception cref="System.ArgumentException"></exception>
Task<User> CreateUser(string name);
/// <summary>
/// Deletes the user.
/// </summary>
/// <param name="user">The user.</param>
/// <returns>Task.</returns>
/// <exception cref="System.ArgumentNullException">user</exception>
/// <exception cref="System.ArgumentException"></exception>
Task DeleteUser(User user);
2013-03-13 05:19:03 +00:00
/// <summary>
/// Resets the password.
/// </summary>
/// <param name="user">The user.</param>
/// <returns>Task.</returns>
Task ResetPassword(User user);
2015-01-30 05:18:32 +00:00
/// <summary>
/// Gets the offline user dto.
/// </summary>
/// <param name="user">The user.</param>
/// <returns>UserDto.</returns>
2015-02-14 19:36:40 +00:00
UserDto GetOfflineUserDto(User user);
2015-01-30 05:18:32 +00:00
2015-01-29 06:06:24 +00:00
/// <summary>
/// Resets the easy password.
/// </summary>
/// <param name="user">The user.</param>
/// <returns>Task.</returns>
Task ResetEasyPassword(User user);
2013-03-13 05:19:03 +00:00
/// <summary>
/// Changes the password.
/// </summary>
/// <param name="user">The user.</param>
2014-11-05 19:28:41 +00:00
/// <param name="newPasswordSha1">The new password sha1.</param>
2013-03-13 05:19:03 +00:00
/// <returns>Task.</returns>
2014-11-05 19:28:41 +00:00
Task ChangePassword(User user, string newPasswordSha1);
2014-08-15 16:35:41 +00:00
2015-01-29 06:06:24 +00:00
/// <summary>
/// Changes the easy password.
/// </summary>
/// <param name="user">The user.</param>
/// <param name="newPasswordSha1">The new password sha1.</param>
/// <returns>Task.</returns>
Task ChangeEasyPassword(User user, string newPasswordSha1);
2014-08-15 16:35:41 +00:00
/// <summary>
/// Gets the user dto.
/// </summary>
/// <param name="user">The user.</param>
/// <param name="remoteEndPoint">The remote end point.</param>
/// <returns>UserDto.</returns>
UserDto GetUserDto(User user, string remoteEndPoint = null);
2014-10-17 04:52:41 +00:00
/// <summary>
/// Authenticates the user.
/// </summary>
/// <param name="username">The username.</param>
/// <param name="passwordSha1">The password sha1.</param>
/// <param name="passwordMd5">The password MD5.</param>
/// <param name="remoteEndPoint">The remote end point.</param>
/// <returns>Task&lt;System.Boolean&gt;.</returns>
2017-04-06 20:07:25 +00:00
Task<User> AuthenticateUser(string username, string passwordSha1, string passwordMd5, string remoteEndPoint);
/// <summary>
/// Starts the forgot password process.
/// </summary>
/// <param name="enteredUsername">The entered username.</param>
/// <param name="isInNetwork">if set to <c>true</c> [is in network].</param>
/// <returns>ForgotPasswordResult.</returns>
ForgotPasswordResult StartForgotPasswordProcess(string enteredUsername, bool isInNetwork);
/// <summary>
/// Redeems the password reset pin.
/// </summary>
/// <param name="pin">The pin.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
Task<PinRedeemResult> RedeemPasswordResetPin(string pin);
2014-11-30 19:01:33 +00:00
/// <summary>
/// Gets the user policy.
/// </summary>
2014-12-16 05:01:57 +00:00
/// <param name="user">The user.</param>
2014-11-30 19:01:33 +00:00
/// <returns>UserPolicy.</returns>
2014-12-16 05:01:57 +00:00
UserPolicy GetUserPolicy(User user);
2014-11-30 19:01:33 +00:00
2014-12-20 06:06:27 +00:00
/// <summary>
/// Gets the user configuration.
/// </summary>
/// <param name="user">The user.</param>
/// <returns>UserConfiguration.</returns>
UserConfiguration GetUserConfiguration(User user);
/// <summary>
/// Updates the configuration.
/// </summary>
/// <param name="userId">The user identifier.</param>
/// <param name="newConfiguration">The new configuration.</param>
/// <returns>Task.</returns>
Task UpdateConfiguration(string userId, UserConfiguration newConfiguration);
2014-11-30 19:01:33 +00:00
/// <summary>
/// Updates the user policy.
/// </summary>
/// <param name="userId">The user identifier.</param>
/// <param name="userPolicy">The user policy.</param>
Task UpdateUserPolicy(string userId, UserPolicy userPolicy);
2014-12-23 03:58:14 +00:00
/// <summary>
/// Makes the valid username.
/// </summary>
/// <param name="username">The username.</param>
/// <returns>System.String.</returns>
string MakeValidUsername(string username);
}
}