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;
|
2013-02-27 20:25:45 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Library
|
|
|
|
|
{
|
2013-04-05 19:34:33 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interface IUserManager
|
|
|
|
|
/// </summary>
|
2013-02-27 20:25:45 +00:00
|
|
|
|
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;
|
2014-06-22 05:52:31 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Updates the configuration.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="user">The user.</param>
|
|
|
|
|
/// <param name="newConfiguration">The new configuration.</param>
|
|
|
|
|
void UpdateConfiguration(User user, UserConfiguration newConfiguration);
|
2013-07-07 02:01:14 +00:00
|
|
|
|
|
2013-02-27 20:25:45 +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);
|
|
|
|
|
|
2013-02-27 20:25:45 +00:00
|
|
|
|
/// <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>
|
2013-02-27 20:25:45 +00:00
|
|
|
|
/// <param name="password">The password.</param>
|
2014-08-15 16:35:41 +00:00
|
|
|
|
/// <param name="remoteEndPoint">The remote end point.</param>
|
2013-02-27 20:25:45 +00:00
|
|
|
|
/// <returns>Task{System.Boolean}.</returns>
|
|
|
|
|
/// <exception cref="System.ArgumentNullException">user</exception>
|
2014-08-15 16:35:41 +00:00
|
|
|
|
Task<bool> AuthenticateUser(string username, string password, string remoteEndPoint);
|
|
|
|
|
|
2013-02-27 20:25:45 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Refreshes metadata for each user
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
2014-03-07 18:48:55 +00:00
|
|
|
|
Task RefreshUsersMetadata(CancellationToken cancellationToken);
|
2013-02-27 20:25:45 +00:00
|
|
|
|
|
|
|
|
|
/// <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);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Changes the password.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="user">The user.</param>
|
|
|
|
|
/// <param name="newPassword">The new password.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
Task ChangePassword(User user, string newPassword);
|
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);
|
2013-02-27 20:25:45 +00:00
|
|
|
|
}
|
|
|
|
|
}
|