summaryrefslogtreecommitdiffstats
path: root/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Server/RequestHandlers/UserRequestHandlerGroup.cpp')
-rw-r--r--src/Server/RequestHandlers/UserRequestHandlerGroup.cpp38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp b/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp
index 7836c34..3aaa576 100644
--- a/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp
+++ b/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp
@@ -18,14 +18,16 @@
*/
#include "UserRequestHandlerGroup.h"
+#include "../Application.h"
#include "../UserManager.h"
namespace Mad {
namespace Server {
namespace RequestHandlers {
-void UserRequestHandlerGroup::handleUserListRequest(boost::shared_ptr<const Common::XmlPacket> packet _UNUSED_PARAMETER_, Common::XmlPacket *ret) {
- boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > info = UserManager::get()->getUserList();
+void UserRequestHandlerGroup::handleUserListRequest(boost::shared_ptr<const Common::XmlPacket> packet _UNUSED_PARAMETER_, Common::XmlPacket *ret,
+ Common::Connection *connection _UNUSED_PARAMETER_) {
+ boost::shared_ptr<std::map<unsigned long, Common::UserInfo> > info = application->getUserManager()->getUserList();
ret->setType("OK");
ret->addList("users");
@@ -41,8 +43,9 @@ void UserRequestHandlerGroup::handleUserListRequest(boost::shared_ptr<const Comm
}
}
-void UserRequestHandlerGroup::handleUserInfoRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret) {
- boost::shared_ptr<Common::UserInfo> info = UserManager::get()->getUserInfo((*packet)["uid"]);
+void UserRequestHandlerGroup::handleUserInfoRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret,
+ Common::Connection *connection _UNUSED_PARAMETER_) {
+ boost::shared_ptr<Common::UserInfo> info = application->getUserManager()->getUserInfo((*packet)["uid"]);
ret->setType("OK");
@@ -52,8 +55,9 @@ void UserRequestHandlerGroup::handleUserInfoRequest(boost::shared_ptr<const Comm
ret->add("fullName", info->getFullName());
}
-void UserRequestHandlerGroup::handleUserGroupListRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret) {
- boost::shared_ptr<std::set<unsigned long> > groups = UserManager::get()->getUserGroupList((unsigned long)(*packet)["uid"]);
+void UserRequestHandlerGroup::handleUserGroupListRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret,
+ Common::Connection *connection _UNUSED_PARAMETER_) {
+ boost::shared_ptr<std::set<unsigned long> > groups = application->getUserManager()->getUserGroupList((unsigned long)(*packet)["uid"]);
ret->setType("OK");
ret->addList("groups");
@@ -66,8 +70,9 @@ void UserRequestHandlerGroup::handleUserGroupListRequest(boost::shared_ptr<const
}
}
-void UserRequestHandlerGroup::handleGroupListRequest(boost::shared_ptr<const Common::XmlPacket> packet _UNUSED_PARAMETER_, Common::XmlPacket *ret) {
- boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > info = UserManager::get()->getGroupList();
+void UserRequestHandlerGroup::handleGroupListRequest(boost::shared_ptr<const Common::XmlPacket> packet _UNUSED_PARAMETER_, Common::XmlPacket *ret,
+ Common::Connection *connection _UNUSED_PARAMETER_) {
+ boost::shared_ptr<std::map<unsigned long, Common::GroupInfo> > info = application->getUserManager()->getGroupList();
ret->setType("OK");
ret->addList("groups");
@@ -81,8 +86,9 @@ void UserRequestHandlerGroup::handleGroupListRequest(boost::shared_ptr<const Com
}
}
-void UserRequestHandlerGroup::handleGroupUserListRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret) {
- boost::shared_ptr<std::set<unsigned long> > users = UserManager::get()->getGroupUserList((unsigned long)(*packet)["gid"]);
+void UserRequestHandlerGroup::handleGroupUserListRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret,
+ Common::Connection *connection _UNUSED_PARAMETER_) {
+ boost::shared_ptr<std::set<unsigned long> > users = application->getUserManager()->getGroupUserList((unsigned long)(*packet)["gid"]);
ret->setType("OK");
ret->addList("users");
@@ -95,12 +101,12 @@ void UserRequestHandlerGroup::handleGroupUserListRequest(boost::shared_ptr<const
}
}
-UserRequestHandlerGroup::UserRequestHandlerGroup() {
- registerHandler("ListUsers", &UserRequestHandlerGroup::handleUserListRequest);
- registerHandler("GetUserInfo", &UserRequestHandlerGroup::handleUserInfoRequest);
- registerHandler("ListUserGroups", &UserRequestHandlerGroup::handleUserGroupListRequest);
- registerHandler("ListGroups", &UserRequestHandlerGroup::handleGroupListRequest);
- registerHandler("ListGroupUsers", &UserRequestHandlerGroup::handleGroupUserListRequest);
+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));
+ registerHandler("ListUserGroups", boost::bind(&UserRequestHandlerGroup::handleUserGroupListRequest, this, _1, _2, _3));
+ registerHandler("ListGroups", boost::bind(&UserRequestHandlerGroup::handleGroupListRequest, this, _1, _2, _3));
+ registerHandler("ListGroupUsers", boost::bind(&UserRequestHandlerGroup::handleGroupUserListRequest, this, _1, _2, _3));
}
}