From 85e004941c01c5ac6fe4d01544845a32b20ba34a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 15 Dec 2008 07:43:38 +0100 Subject: Verarbeite Konfiguration im UserBackendMysql --- src/modules/UserBackendMysql.cpp | 57 +++++++++++++++++++++++++++++++++++++++- src/modules/UserBackendMysql.h | 7 +++++ 2 files changed, 63 insertions(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/UserBackendMysql.cpp b/src/modules/UserBackendMysql.cpp index f27bea5..465a22f 100644 --- a/src/modules/UserBackendMysql.cpp +++ b/src/modules/UserBackendMysql.cpp @@ -18,6 +18,7 @@ */ #include "UserBackendMysql.h" +#include #define init UserBackendMysql_LTX_init #define deinit UserBackendMysql_LTX_deinit @@ -26,8 +27,62 @@ namespace Mad { namespace Modules { -bool UserBackendMysql::handleConfigEntry(const Common::ConfigEntry&, bool handled) { +bool UserBackendMysql::handleConfigEntry(const Common::ConfigEntry &entry, bool handled) { + if(handled) + return false; + if(entry[0].getKey().matches("UserBackendMysql")) { + if(entry[1].getKey().matches("Host")) { + if(entry[2].empty()) + host = entry[1][0]; + } + else if(entry[1].getKey().matches("Username")) { + if(entry[2].empty()) + username = entry[1][0]; + } + else if(entry[1].getKey().matches("Password")) { + if(entry[2].empty()) + password = entry[1][0]; + } + else if(entry[1].getKey().matches("Database")) { + if(entry[2].empty()) + db = entry[1][0]; + } + else if(entry[1].getKey().matches("Queries")) { + if(entry[2].getKey().matches("ListUsers")) { + if(entry[3].empty()) + queryListUsers = entry[2][0]; + } + else if(entry[2].getKey().matches("ListGroups")) { + if(entry[3].empty()) + queryListGroups = entry[2][0]; + } + else if(entry[2].getKey().matches("ListUserGroups")) { + if(entry[3].empty()) + queryListUserGroups = entry[2][0]; + } + else if(entry[2].getKey().matches("ListGroupUsers")) { + if(entry[3].empty()) + queryListGroupUsers = entry[2][0]; + } + else if(entry[2].getKey().matches("UserById")) { + if(entry[3].empty()) + queryUserById = entry[2][0]; + } + else if(entry[2].getKey().matches("UserByName")) { + if(entry[3].empty()) + queryUserByName = entry[2][0]; + } + else if(entry[2].getKey().matches("GroupById")) { + if(entry[3].empty()) + queryGroupById = entry[2][0]; + } + else if(entry[2].getKey().matches("GroupByName")) { + if(entry[3].empty()) + queryGroupByName = entry[2][0]; + } + } + } } void UserBackendMysql::configFinished() { diff --git a/src/modules/UserBackendMysql.h b/src/modules/UserBackendMysql.h index 7e134e5..85a25ee 100644 --- a/src/modules/UserBackendMysql.h +++ b/src/modules/UserBackendMysql.h @@ -32,6 +32,13 @@ class UserBackendMysql : private Core::UserBackend, private Common::Configurable private: static UserBackendMysql *backend; + std::string host, username, password, db; + + std::string queryListUsers, queryListGroups; + std::string queryListUserGroups, queryListGroupUsers; + std::string queryUserById, queryUserByName; + std::string queryGroupById, queryGroupByName; + UserBackendMysql() {} protected: -- cgit v1.2.3