diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-07-10 02:08:03 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-07-10 02:08:03 +0200 |
commit | f892ec46086eee9c4bfb954469016829fb201532 (patch) | |
tree | c6abb16ea1b52953a37da995dc988c823685a46a /src/Server/RequestHandlers | |
parent | 5bf8b6ce656ffe0740ec116057577044e3925887 (diff) | |
download | mad-f892ec46086eee9c4bfb954469016829fb201532.tar mad-f892ec46086eee9c4bfb954469016829fb201532.zip |
updateUser und deleteUser zum UserBackendMysql, NetworkUserBackend und Client hinzugefügt
Diffstat (limited to 'src/Server/RequestHandlers')
-rw-r--r-- | src/Server/RequestHandlers/UserRequestHandlerGroup.cpp | 20 | ||||
-rw-r--r-- | src/Server/RequestHandlers/UserRequestHandlerGroup.h | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp b/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp index 43d6bc4..e0c4020 100644 --- a/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp +++ b/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp @@ -258,6 +258,24 @@ void UserRequestHandlerGroup::handleUserAddRequest(boost::shared_ptr<const Commo ret->setType("OK"); } +void UserRequestHandlerGroup::handleUserUpdateRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, + Common::Connection *connection _UNUSED_PARAMETER_) { + Common::UserInfo userInfo(packet->get<unsigned long>("uid"), packet->get<const std::string&>("username")); + userInfo.setGid(packet->get<unsigned long>("gid")); + userInfo.setFullName(packet->get<const std::string&>("fullName")); + + application->getUserManager()->updateUser(packet->get<unsigned long>("origUid"), userInfo); + + ret->setType("OK"); +} + +void UserRequestHandlerGroup::handleUserDeleteRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, + Common::Connection *connection _UNUSED_PARAMETER_) { + application->getUserManager()->deleteUser(packet->get<unsigned long>("uid")); + + ret->setType("OK"); +} + UserRequestHandlerGroup::UserRequestHandlerGroup(Application *application0) : application(application0) { registerHandler("ListUsers", boost::bind(&UserRequestHandlerGroup::handleUserListRequest, this, _1, _2, _3)); registerHandler("GetUserInfo", boost::bind(&UserRequestHandlerGroup::handleUserInfoRequest, this, _1, _2, _3)); @@ -270,6 +288,8 @@ UserRequestHandlerGroup::UserRequestHandlerGroup(Application *application0) : ap registerHandler("GetFullUserGroupList", boost::bind(&UserRequestHandlerGroup::handleFullUserGroupListRequest, this, _1, _2, _3)); registerHandler("AddUser", boost::bind(&UserRequestHandlerGroup::handleUserAddRequest, this, _1, _2, _3)); + registerHandler("UpdateUser", boost::bind(&UserRequestHandlerGroup::handleUserUpdateRequest, this, _1, _2, _3)); + registerHandler("DeleteUser", boost::bind(&UserRequestHandlerGroup::handleUserDeleteRequest, this, _1, _2, _3)); } } diff --git a/src/Server/RequestHandlers/UserRequestHandlerGroup.h b/src/Server/RequestHandlers/UserRequestHandlerGroup.h index f39754e..24a689b 100644 --- a/src/Server/RequestHandlers/UserRequestHandlerGroup.h +++ b/src/Server/RequestHandlers/UserRequestHandlerGroup.h @@ -44,6 +44,8 @@ class UserRequestHandlerGroup : public Common::RequestHandlers::SimpleRequestHan void handleFullUserGroupListRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); void handleUserAddRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); + void handleUserUpdateRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); + void handleUserDeleteRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); public: UserRequestHandlerGroup(Application *application0); |