From 153fb211ac2342907eb766a79c1f41824f981ab5 Mon Sep 17 00:00:00 2001 From: Ben Deutsch Date: Sun, 5 Aug 2018 13:13:38 +0200 Subject: Replace auth.txt with SQLite auth database (#7279) * Replace auth.txt with SQLite auth database --- src/database/database-files.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/database/database-files.h') diff --git a/src/database/database-files.h b/src/database/database-files.h index f0824a304..218815cf7 100644 --- a/src/database/database-files.h +++ b/src/database/database-files.h @@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc., // for player files #include "database.h" +#include class PlayerDatabaseFiles : public PlayerDatabase { @@ -41,3 +42,23 @@ private: std::string m_savedir; }; + +class AuthDatabaseFiles : public AuthDatabase +{ +public: + AuthDatabaseFiles(const std::string &savedir); + virtual ~AuthDatabaseFiles() = default; + + virtual bool getAuth(const std::string &name, AuthEntry &res); + virtual bool saveAuth(const AuthEntry &authEntry); + virtual bool createAuth(AuthEntry &authEntry); + virtual bool deleteAuth(const std::string &name); + virtual void listNames(std::vector &res); + virtual void reload(); + +private: + std::unordered_map m_auth_list; + std::string m_savedir; + bool readAuthFile(); + bool writeAuthFile(); +}; -- cgit v1.2.3