mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Add PostgreSQL authentication backend (#9756)
* Add PostgreSQL authentication backend
This commit is contained in:
parent
2fe4641c1e
commit
e564bf8ead
3 changed files with 207 additions and 0 deletions
|
@ -36,6 +36,7 @@ public:
|
|||
|
||||
void beginSave();
|
||||
void endSave();
|
||||
void rollback();
|
||||
|
||||
bool initialized() const;
|
||||
|
||||
|
@ -148,3 +149,26 @@ protected:
|
|||
private:
|
||||
bool playerDataExists(const std::string &playername);
|
||||
};
|
||||
|
||||
class AuthDatabasePostgreSQL : private Database_PostgreSQL, public AuthDatabase
|
||||
{
|
||||
public:
|
||||
AuthDatabasePostgreSQL(const std::string &connect_string);
|
||||
virtual ~AuthDatabasePostgreSQL() = default;
|
||||
|
||||
virtual void pingDatabase() { Database_PostgreSQL::pingDatabase(); }
|
||||
|
||||
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<std::string> &res);
|
||||
virtual void reload();
|
||||
|
||||
protected:
|
||||
virtual void createDatabase();
|
||||
virtual void initStatements();
|
||||
|
||||
private:
|
||||
virtual void writePrivileges(const AuthEntry &authEntry);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue