|
|
|
@ -6,14 +6,52 @@ using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Model
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Define how to manage an user.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public interface IUserManager
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get the current connected user. Null if no user is connected.
|
|
|
|
|
/// </summary>
|
|
|
|
|
User? CurrentConnected { get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get the password manager used to hash passords.
|
|
|
|
|
/// </summary>
|
|
|
|
|
IPasswordManager PasswordManager { get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get a collection of all users in the data.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>A collection of all user.</returns>
|
|
|
|
|
ICollection<User> GetAllUsers();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get an user by his email.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="mail">The user's mail.</param>
|
|
|
|
|
/// <returns>The user corresponding to the mail.</returns>
|
|
|
|
|
User GetUserFromMail(string mail);
|
|
|
|
|
User CreateUser(string? name, string? surname, string mail, string password, string? profilePict);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Create a new user. The mail and the password are required. Other can be null.
|
|
|
|
|
/// <br/>This function use the password manager to hash the plain text password.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="mail">The user's mail address.</param>
|
|
|
|
|
/// <param name="password">The user's plain text password.</param>
|
|
|
|
|
/// <param name="name">The user's name.</param>
|
|
|
|
|
/// <param name="surname">The user's surname.</param>
|
|
|
|
|
/// <param name="profilePict">The user's profile picture.</param>
|
|
|
|
|
/// <returns>A new user.</returns>
|
|
|
|
|
User CreateUser(string mail, string password,
|
|
|
|
|
string? name = null, string? surname = null, string? profilePict = null);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="user"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
bool AddUserToData(User user);
|
|
|
|
|
bool ModifyCurrentConnected(User newUser);
|
|
|
|
|
bool LogIn(string mail, string password);
|
|
|
|
|