using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Model { /// /// Define how to manage an user. /// public interface IUserManager { /// /// Get the current connected user. Null if no user is connected. /// User? CurrentConnected { get; } /// /// Get the password manager used to hash passords. /// IPasswordManager PasswordManager { get; } /// /// Get a collection of all users in the data. /// /// A collection of all user. ICollection GetAllUsers(); /// /// Get an user by his email. /// /// The user's mail. /// The user corresponding to the mail. User GetUserFromMail(string mail); /// /// Create a new user. The mail and the password are required. Other can be null. ///
This function use the password manager to hash the plain text password. ///
/// The user's mail address. /// The user's plain text password. /// The user's name. /// The user's surname. /// The user's profile picture. /// A new user. User CreateUser(string mail, string password, string? name = null, string? surname = null, string? profilePict = null); /// /// Add an user in the data. /// /// The user to add. /// True is the user was correctly added to the data. False otherwise. bool AddUserToData(User user); /// /// Modify the currently connected user. /// /// An user containing new user's properties to changes. /// bool ModifyCurrentConnected(User newUser); /// /// Log in an user. If the connection succed, pass the connected user to . /// /// The User's mail. /// The User's (plain text) password. /// True if the connection succed, false otherwise. bool LogIn(string mail, string password); /// /// Log out the current connected user. /// void LogOut(); } }