summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2008-12-15 07:43:38 +0100
committerMatthias Schiffer <matthias@gamezock.de>2008-12-15 07:43:38 +0100
commit85e004941c01c5ac6fe4d01544845a32b20ba34a (patch)
treed6a6fcbb71fa36bb7aaa7f29611607360a82eaf0 /src/modules
parent5563591965b51f89f61859ef1a88ae8ff6eff106 (diff)
downloadmad-85e004941c01c5ac6fe4d01544845a32b20ba34a.tar
mad-85e004941c01c5ac6fe4d01544845a32b20ba34a.zip
Verarbeite Konfiguration im UserBackendMysql
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/UserBackendMysql.cpp57
-rw-r--r--src/modules/UserBackendMysql.h7
2 files changed, 63 insertions, 1 deletions
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 <Common/ConfigEntry.h>
#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: