summaryrefslogtreecommitdiffstats
path: root/src/Server
diff options
context:
space:
mode:
Diffstat (limited to 'src/Server')
-rw-r--r--src/Server/RequestHandlers/UserRequestHandlerGroup.cpp20
-rw-r--r--src/Server/RequestHandlers/UserRequestHandlerGroup.h2
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);