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