From f7d433e6e8559b4584263cae025d3addd1342df4 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 5 Aug 2009 23:55:44 +0200 Subject: =?UTF-8?q?UserManager:=20Check-Funktionen=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RequestHandlers/UserRequestHandlerGroup.cpp | 49 ++++++++++++++++++++++ .../RequestHandlers/UserRequestHandlerGroup.h | 6 +++ 2 files changed, 55 insertions(+) (limited to 'src/Server') diff --git a/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp b/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp index b830920..c0de46a 100644 --- a/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp +++ b/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp @@ -245,6 +245,18 @@ void UserRequestHandlerGroup::handleFullUserGroupListRequest(boost::shared_ptr packet, Common::XmlPacket *ret, + Common::Connection* /*connection*/) { + Common::UserInfo userInfo(packet->get("uid"), packet->get("username")); + userInfo.setGid(packet->get("gid")); + userInfo.setFullName(packet->get("fullName")); + + application->getUserManager()->checkUserInfo(userInfo); + + ret->setType("OK"); +} + void UserRequestHandlerGroup::handleUserAddRequest(boost::shared_ptr packet, Common::XmlPacket *ret, Common::Connection* /*connection*/) { Common::UserInfo userInfo(packet->get("uid"), packet->get("username")); @@ -274,6 +286,37 @@ void UserRequestHandlerGroup::handleUserDeleteRequest(boost::shared_ptrsetType("OK"); } + +void UserRequestHandlerGroup::handleGroupInfoCheckRequest(boost::shared_ptr packet, Common::XmlPacket *ret, + Common::Connection* /*connection*/) { + application->getUserManager()->checkGroupInfo(Common::GroupInfo(packet->get("gid"), packet->get("name"))); + + ret->setType("OK"); +} + +void UserRequestHandlerGroup::handleGroupAddRequest(boost::shared_ptr packet, Common::XmlPacket *ret, + Common::Connection* /*connection*/) { + application->getUserManager()->addGroup(Common::GroupInfo(packet->get("gid"), packet->get("name"))); + + ret->setType("OK"); +} + +void UserRequestHandlerGroup::handleGroupUpdateRequest(boost::shared_ptr packet, Common::XmlPacket *ret, + Common::Connection* /*connection*/) { + application->getUserManager()->updateGroup(packet->get("origGid"), + Common::GroupInfo(packet->get("gid"), packet->get("name"))); + + ret->setType("OK"); +} + +void UserRequestHandlerGroup::handleGroupDeleteRequest(boost::shared_ptr packet, Common::XmlPacket *ret, + Common::Connection* /*connection*/) { + application->getUserManager()->deleteGroup(packet->get("gid")); + + ret->setType("OK"); +} + + void UserRequestHandlerGroup::handleAddUserToGroupRequest(boost::shared_ptr packet, Common::XmlPacket *ret, Common::Connection* /*connection*/) { application->getUserManager()->addUserToGroup(packet->get("uid"), packet->get("gid")); @@ -299,10 +342,16 @@ UserRequestHandlerGroup::UserRequestHandlerGroup(Application *application0) : ap registerHandler("GetFullUserGroupList", boost::bind(&UserRequestHandlerGroup::handleFullUserGroupListRequest, this, _1, _2, _3)); + registerHandler("CheckUserInfo", boost::bind(&UserRequestHandlerGroup::handleUserInfoCheckRequest, 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)); + registerHandler("CheckGroupInfo", boost::bind(&UserRequestHandlerGroup::handleGroupInfoCheckRequest, this, _1, _2, _3)); + registerHandler("AddGroup", boost::bind(&UserRequestHandlerGroup::handleGroupAddRequest, this, _1, _2, _3)); + registerHandler("UpdateGroup", boost::bind(&UserRequestHandlerGroup::handleGroupUpdateRequest, this, _1, _2, _3)); + registerHandler("DeleteGroup", boost::bind(&UserRequestHandlerGroup::handleGroupDeleteRequest, this, _1, _2, _3)); + registerHandler("AddUserToGroup", boost::bind(&UserRequestHandlerGroup::handleAddUserToGroupRequest, this, _1, _2, _3)); registerHandler("DeleteUserFromGroup", boost::bind(&UserRequestHandlerGroup::handleDeleteUserFromGroupRequest, this, _1, _2, _3)); } diff --git a/src/Server/RequestHandlers/UserRequestHandlerGroup.h b/src/Server/RequestHandlers/UserRequestHandlerGroup.h index 6da97a3..c1338c4 100644 --- a/src/Server/RequestHandlers/UserRequestHandlerGroup.h +++ b/src/Server/RequestHandlers/UserRequestHandlerGroup.h @@ -43,10 +43,16 @@ class UserRequestHandlerGroup : public Common::RequestHandlers::SimpleRequestHan void handleFullUserGroupListRequest(boost::shared_ptr packet, Common::XmlPacket *ret, Common::Connection *connection); + void handleUserInfoCheckRequest(boost::shared_ptr packet, Common::XmlPacket *ret, Common::Connection *connection); void handleUserAddRequest(boost::shared_ptr packet, Common::XmlPacket *ret, Common::Connection *connection); void handleUserUpdateRequest(boost::shared_ptr packet, Common::XmlPacket *ret, Common::Connection *connection); void handleUserDeleteRequest(boost::shared_ptr packet, Common::XmlPacket *ret, Common::Connection *connection); + void handleGroupInfoCheckRequest(boost::shared_ptr packet, Common::XmlPacket *ret, Common::Connection *connection); + void handleGroupAddRequest(boost::shared_ptr packet, Common::XmlPacket *ret, Common::Connection *connection); + void handleGroupUpdateRequest(boost::shared_ptr packet, Common::XmlPacket *ret, Common::Connection *connection); + void handleGroupDeleteRequest(boost::shared_ptr packet, Common::XmlPacket *ret, Common::Connection *connection); + void handleAddUserToGroupRequest(boost::shared_ptr packet, Common::XmlPacket *ret, Common::Connection *connection); void handleDeleteUserFromGroupRequest(boost::shared_ptr packet, Common::XmlPacket *ret, Common::Connection *connection); -- cgit v1.2.3