using DbAPI.User; using DTS.Common.Interface.Database; using System; namespace DbAPI.Connections { /// /// Connection related functions (Connect, Login, GetLoggedInUsers) /// public interface IConnections { /// /// Used to retrieve all current connections /// /// all dbs that were successfully connected to IConnectionDetails[] GetActiveConnections(); /// /// attempts to login user /// /// Database user belongs to /// the DataPRO user to log in /// the already hashed and salted password value /// [Output]User instance if login was successful /// 0 (ERROR_SUCCESS) on success, all other returns are errors. /// ERROR_LOGINFAILED indicates a failed login while ERROR_UNKNOWN indicates an unexpected error ulong LoginUserHash(IConnectionDetails connection, string user, string hash, out IUserDbRecord userObject); /// /// attempts to login user /// /// Database user belongs to /// the DataPRO user to log in /// password belonging to user /// [Output]User instance if login was successful /// 0 (ERROR_SUCCESS) on success, all other returns are errors. /// ERROR_LOGINFAILED indicates a failed login while ERROR_UNKNOWN indicates an unexpected error ulong LoginUser(IConnectionDetails connection, string user, string password, out IUserDbRecord userObject); /// /// Attempts to connect database /// /// connection details for use in connecting database /// returns 0 on success (ERROR_SUCCESS), all other values are errors ulong ConnectToDb(IConnectionDetails details); /// /// checks whether a user is currently logged in to the given database /// /// user to check /// database user should be logged in to /// returns true if user is logged in, otherwise false bool IsUserLoggedIn(IUserDbRecord user, IConnectionDetails connection); /// /// returns all logged in users on all databases connected /// /// all logged in users on all databases connected Tuple[] GetLoggedInUsers(); /// /// removes all logged in users and all database connections /// void ClearConnections(); } }