diff options
Diffstat (limited to 'src/Server')
-rw-r--r-- | src/Server/RequestHandlers/UserRequestHandlerGroup.cpp | 49 | ||||
-rw-r--r-- | src/Server/RequestHandlers/UserRequestHandlerGroup.h | 6 |
2 files changed, 55 insertions, 0 deletions
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<c } } + +void UserRequestHandlerGroup::handleUserInfoCheckRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, + Common::Connection* /*connection*/) { + 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()->checkUserInfo(userInfo); + + ret->setType("OK"); +} + void UserRequestHandlerGroup::handleUserAddRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection* /*connection*/) { Common::UserInfo userInfo(packet->get<unsigned long>("uid"), packet->get<const std::string&>("username")); @@ -274,6 +286,37 @@ void UserRequestHandlerGroup::handleUserDeleteRequest(boost::shared_ptr<const Co ret->setType("OK"); } + +void UserRequestHandlerGroup::handleGroupInfoCheckRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, + Common::Connection* /*connection*/) { + application->getUserManager()->checkGroupInfo(Common::GroupInfo(packet->get<unsigned long>("gid"), packet->get<const std::string&>("name"))); + + ret->setType("OK"); +} + +void UserRequestHandlerGroup::handleGroupAddRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, + Common::Connection* /*connection*/) { + application->getUserManager()->addGroup(Common::GroupInfo(packet->get<unsigned long>("gid"), packet->get<const std::string&>("name"))); + + ret->setType("OK"); +} + +void UserRequestHandlerGroup::handleGroupUpdateRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, + Common::Connection* /*connection*/) { + application->getUserManager()->updateGroup(packet->get<unsigned long>("origGid"), + Common::GroupInfo(packet->get<unsigned long>("gid"), packet->get<const std::string&>("name"))); + + ret->setType("OK"); +} + +void UserRequestHandlerGroup::handleGroupDeleteRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, + Common::Connection* /*connection*/) { + application->getUserManager()->deleteGroup(packet->get<unsigned long>("gid")); + + ret->setType("OK"); +} + + void UserRequestHandlerGroup::handleAddUserToGroupRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection* /*connection*/) { application->getUserManager()->addUserToGroup(packet->get<unsigned long>("uid"), packet->get<unsigned long>("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<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); + void handleUserInfoCheckRequest(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); + void handleGroupInfoCheckRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); + void handleGroupAddRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); + void handleGroupUpdateRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); + void handleGroupDeleteRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); + void handleAddUserToGroupRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); void handleDeleteUserFromGroupRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection); |