2019-01-13 20:01:16 +00:00
|
|
|
using System;
|
2018-12-27 23:27:57 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using MediaBrowser.Controller.Authentication;
|
2019-01-13 19:25:32 +00:00
|
|
|
using MediaBrowser.Controller.Entities;
|
|
|
|
using MediaBrowser.Model.Configuration;
|
|
|
|
using MediaBrowser.Model.Dto;
|
|
|
|
using MediaBrowser.Model.Events;
|
|
|
|
using MediaBrowser.Model.Users;
|
2018-12-27 23:27:57 +00:00
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Library
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Interface IUserManager
|
|
|
|
/// </summary>
|
|
|
|
public interface IUserManager
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the users.
|
|
|
|
/// </summary>
|
|
|
|
/// <value>The users.</value>
|
|
|
|
IEnumerable<User> Users { get; }
|
|
|
|
|
2019-06-09 20:08:01 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Gets the user ids.
|
|
|
|
/// </summary>
|
|
|
|
/// <value>The users ids.</value>
|
|
|
|
IEnumerable<Guid> UsersIds { get; }
|
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Occurs when [user updated].
|
|
|
|
/// </summary>
|
|
|
|
event EventHandler<GenericEventArgs<User>> UserUpdated;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Occurs when [user deleted].
|
|
|
|
/// </summary>
|
|
|
|
event EventHandler<GenericEventArgs<User>> UserDeleted;
|
|
|
|
|
|
|
|
event EventHandler<GenericEventArgs<User>> UserCreated;
|
2019-10-20 19:12:03 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
event EventHandler<GenericEventArgs<User>> UserPolicyUpdated;
|
2019-10-20 19:12:03 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
event EventHandler<GenericEventArgs<User>> UserConfigurationUpdated;
|
2019-10-20 19:12:03 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
event EventHandler<GenericEventArgs<User>> UserPasswordChanged;
|
2019-10-20 19:12:03 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
event EventHandler<GenericEventArgs<User>> UserLockedOut;
|
|
|
|
|
|
|
|
/// <summary>
|
2019-11-17 22:05:39 +00:00
|
|
|
/// Gets a user by Id.
|
2018-12-27 23:27:57 +00:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="id">The id.</param>
|
2019-10-29 16:50:09 +00:00
|
|
|
/// <returns>The user with the specified Id, or <c>null</c> if the user doesn't exist.</returns>
|
2019-10-20 19:12:03 +00:00
|
|
|
/// <exception cref="ArgumentException"><c>id</c> is an empty Guid.</exception>
|
2018-12-27 23:27:57 +00:00
|
|
|
User GetUserById(Guid id);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the name of the user by.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="name">The name.</param>
|
|
|
|
/// <returns>User.</returns>
|
|
|
|
User GetUserByName(string name);
|
|
|
|
|
|
|
|
/// <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>
|
2019-01-13 20:37:13 +00:00
|
|
|
/// <exception cref="ArgumentNullException">user</exception>
|
|
|
|
/// <exception cref="ArgumentException"></exception>
|
2018-12-27 23:27:57 +00:00
|
|
|
Task RenameUser(User user, string newName);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Updates the user.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="user">The user.</param>
|
2019-01-13 20:37:13 +00:00
|
|
|
/// <exception cref="ArgumentNullException">user</exception>
|
|
|
|
/// <exception cref="ArgumentException"></exception>
|
2018-12-27 23:27:57 +00:00
|
|
|
void UpdateUser(User user);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Creates the user.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="name">The name.</param>
|
|
|
|
/// <returns>User.</returns>
|
2019-01-13 20:37:13 +00:00
|
|
|
/// <exception cref="ArgumentNullException">name</exception>
|
|
|
|
/// <exception cref="ArgumentException"></exception>
|
2019-06-09 20:08:01 +00:00
|
|
|
User CreateUser(string name);
|
2018-12-27 23:27:57 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Deletes the user.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="user">The user.</param>
|
|
|
|
/// <returns>Task.</returns>
|
2019-01-13 20:37:13 +00:00
|
|
|
/// <exception cref="ArgumentNullException">user</exception>
|
|
|
|
/// <exception cref="ArgumentException"></exception>
|
2019-06-09 20:08:01 +00:00
|
|
|
void DeleteUser(User user);
|
2018-12-27 23:27:57 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Resets the password.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="user">The user.</param>
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
Task ResetPassword(User user);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the offline user dto.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="user">The user.</param>
|
|
|
|
/// <returns>UserDto.</returns>
|
|
|
|
UserDto GetOfflineUserDto(User user);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Resets the easy password.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="user">The user.</param>
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
void ResetEasyPassword(User user);
|
2019-01-07 23:27:46 +00:00
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Changes the password.
|
|
|
|
/// </summary>
|
|
|
|
Task ChangePassword(User user, string newPassword);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Changes the easy password.
|
|
|
|
/// </summary>
|
|
|
|
void ChangeEasyPassword(User user, string newPassword, string newPasswordSha1);
|
2019-01-07 23:27:46 +00:00
|
|
|
|
2018-12-27 23:27:57 +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);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Authenticates the user.
|
|
|
|
/// </summary>
|
|
|
|
Task<User> AuthenticateUser(string username, string password, string passwordSha1, string remoteEndPoint, bool isUserSession);
|
|
|
|
|
|
|
|
/// <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>
|
|
|
|
Task<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);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the user policy.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="user">The user.</param>
|
|
|
|
/// <returns>UserPolicy.</returns>
|
|
|
|
UserPolicy GetUserPolicy(User user);
|
|
|
|
|
|
|
|
/// <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>
|
|
|
|
void UpdateConfiguration(Guid userId, UserConfiguration newConfiguration);
|
|
|
|
|
|
|
|
void UpdateConfiguration(User user, UserConfiguration newConfiguration);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Updates the user policy.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="userId">The user identifier.</param>
|
|
|
|
/// <param name="userPolicy">The user policy.</param>
|
|
|
|
void UpdateUserPolicy(Guid userId, UserPolicy userPolicy);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Makes the valid username.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="username">The username.</param>
|
|
|
|
/// <returns>System.String.</returns>
|
|
|
|
string MakeValidUsername(string username);
|
|
|
|
|
2019-03-22 07:01:23 +00:00
|
|
|
void AddParts(IEnumerable<IAuthenticationProvider> authenticationProviders, IEnumerable<IPasswordResetProvider> passwordResetProviders);
|
2018-12-27 23:27:57 +00:00
|
|
|
|
|
|
|
NameIdPair[] GetAuthenticationProviders();
|
2019-03-22 07:01:23 +00:00
|
|
|
NameIdPair[] GetPasswordResetProviders();
|
2018-12-27 23:27:57 +00:00
|
|
|
}
|
|
|
|
}
|