summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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: