jellyfin/MediaBrowser.Controller/Library/IUserManager.cs

221 lines
8.0 KiB
C#
Raw Normal View History

2014-05-08 13:09:53 -07:00
using MediaBrowser.Controller.Entities;
2014-06-21 22:52:31 -07:00
using MediaBrowser.Model.Configuration;
2014-08-15 09:35:41 -07:00
using MediaBrowser.Model.Dto;
2014-05-08 13:09:53 -07: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 12:34:33 -07: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-06 19:01:14 -07:00
event EventHandler<GenericEventArgs<User>> UserCreated;
2014-06-21 22:52:31 -07:00
event EventHandler<GenericEventArgs<User>> UserConfigurationUpdated;
2014-08-10 15:13:17 -07:00
event EventHandler<GenericEventArgs<User>> UserPasswordChanged;
2014-06-21 22:52:31 -07: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 08:10:51 -07:00
/// <summary>
/// Gets the user by identifier.
/// </summary>
/// <param name="id">The identifier.</param>
/// <returns>User.</returns>
User GetUserById(string id);
2014-10-13 21:22:17 -07: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 11:34:08 -07:00
/// <param name="username">The username.</param>
2014-10-13 21:22:17 -07:00
/// <param name="passwordSha1">The password sha1.</param>
2014-08-15 09:35:41 -07:00
/// <param name="remoteEndPoint">The remote end point.</param>
/// <returns>Task{System.Boolean}.</returns>
/// <exception cref="System.ArgumentNullException">user</exception>
2014-10-13 21:22:17 -07:00
Task<bool> AuthenticateUser(string username, string passwordSha1, string remoteEndPoint);
2014-08-15 09:35:41 -07: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-12 22:19:03 -07:00
/// <summary>
/// Resets the password.
/// </summary>
/// <param name="user">The user.</param>
/// <returns>Task.</returns>
Task ResetPassword(User user);
2015-01-29 22:18:32 -07:00
/// <summary>
/// Gets the offline user dto.
/// </summary>
/// <param name="user">The user.</param>
/// <param name="deviceId">The device identifier.</param>
/// <returns>UserDto.</returns>
UserDto GetOfflineUserDto(User user, string deviceId);
2015-01-28 23:06:24 -07:00
/// <summary>
/// Resets the easy password.
/// </summary>
/// <param name="user">The user.</param>
/// <returns>Task.</returns>
Task ResetEasyPassword(User user);
2013-03-12 22:19:03 -07:00
/// <summary>
/// Changes the password.
/// </summary>
/// <param name="user">The user.</param>
2014-11-05 12:28:41 -07:00
/// <param name="newPasswordSha1">The new password sha1.</param>
2013-03-12 22:19:03 -07:00
/// <returns>Task.</returns>
2014-11-05 12:28:41 -07:00
Task ChangePassword(User user, string newPasswordSha1);
2014-08-15 09:35:41 -07:00
2015-01-28 23:06:24 -07: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 09:35:41 -07: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-16 21:52:41 -07: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>
Task<bool> 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 12:01:33 -07:00
/// <summary>
/// Gets the user policy.
/// </summary>
2014-12-15 22:01:57 -07:00
/// <param name="user">The user.</param>
2014-11-30 12:01:33 -07:00
/// <returns>UserPolicy.</returns>
2014-12-15 22:01:57 -07:00
UserPolicy GetUserPolicy(User user);
2014-11-30 12:01:33 -07:00
2014-12-19 23:06:27 -07: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 12:01:33 -07: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-22 20:58:14 -07:00
/// <summary>
/// Makes the valid username.
/// </summary>
/// <param name="username">The username.</param>
/// <returns>System.String.</returns>
string MakeValidUsername(string username);
}
}