summaryrefslogtreecommitdiffstats
path: root/src/modules/UserListManager
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/UserListManager')
-rw-r--r--src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.cpp40
-rw-r--r--src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.h4
-rw-r--r--src/modules/UserListManager/UserListManager.cpp16
-rw-r--r--src/modules/UserListManager/UserListManager.h4
4 files changed, 64 insertions, 0 deletions
diff --git a/src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.cpp b/src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.cpp
index 99d2818..61bbf07 100644
--- a/src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.cpp
+++ b/src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.cpp
@@ -55,6 +55,24 @@ void UserListRequestHandlerGroup::handleUserListDownloadRequest(boost::shared_pt
Util::serializeUserList(userList.get(), ret);
}
+void UserListRequestHandlerGroup::handleUserListCopyRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) {
+ if(!connection->isAuthenticated())
+ throw(Core::Exception(Core::Exception::PERMISSION));
+
+ userListManager->copyUserList(packet->get<const std::string&>("fromName"), packet->get<const std::string&>("toName"));
+
+ ret->setType("OK");
+}
+
+void UserListRequestHandlerGroup::handleUserListRenameRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) {
+ if(!connection->isAuthenticated())
+ throw(Core::Exception(Core::Exception::PERMISSION));
+
+ userListManager->renameUserList(packet->get<const std::string&>("fromName"), packet->get<const std::string&>("toName"));
+
+ ret->setType("OK");
+}
+
void UserListRequestHandlerGroup::handleUserListRemoveRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) {
if(!connection->isAuthenticated())
throw(Core::Exception(Core::Exception::PERMISSION));
@@ -94,6 +112,24 @@ void UserListRequestHandlerGroup::handleUserListDiffDownloadRequest(boost::share
Util::serializeUserListDiff(diff.get(), ret);
}
+void UserListRequestHandlerGroup::handleUserListDiffCopyRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) {
+ if(!connection->isAuthenticated())
+ throw(Core::Exception(Core::Exception::PERMISSION));
+
+ userListManager->copyUserListDiff(packet->get<const std::string&>("fromName"), packet->get<const std::string&>("toName"));
+
+ ret->setType("OK");
+}
+
+void UserListRequestHandlerGroup::handleUserListDiffRenameRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) {
+ if(!connection->isAuthenticated())
+ throw(Core::Exception(Core::Exception::PERMISSION));
+
+ userListManager->renameUserListDiff(packet->get<const std::string&>("fromName"), packet->get<const std::string&>("toName"));
+
+ ret->setType("OK");
+}
+
void UserListRequestHandlerGroup::handleUserListDiffRemoveRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection) {
if(!connection->isAuthenticated())
throw(Core::Exception(Core::Exception::PERMISSION));
@@ -108,10 +144,14 @@ UserListRequestHandlerGroup::UserListRequestHandlerGroup(Server::Application *ap
: application(application0), userListManager(userListManager0) {
registerHandler("ListUserLists", boost::bind(&UserListRequestHandlerGroup::handleUserListListRequest, this, _1, _2, _3));
registerHandler("DownloadUserList", boost::bind(&UserListRequestHandlerGroup::handleUserListDownloadRequest, this, _1, _2, _3));
+ registerHandler("CopyUserList", boost::bind(&UserListRequestHandlerGroup::handleUserListCopyRequest, this, _1, _2, _3));
+ registerHandler("RenameUserList", boost::bind(&UserListRequestHandlerGroup::handleUserListRenameRequest, this, _1, _2, _3));
registerHandler("RemoveUserList", boost::bind(&UserListRequestHandlerGroup::handleUserListRemoveRequest, this, _1, _2, _3));
registerHandler("ListUserListDiffs", boost::bind(&UserListRequestHandlerGroup::handleUserListDiffListRequest, this, _1, _2, _3));
registerHandler("DownloadUserListDiff", boost::bind(&UserListRequestHandlerGroup::handleUserListDiffDownloadRequest, this, _1, _2, _3));
+ registerHandler("CopyUserListDiff", boost::bind(&UserListRequestHandlerGroup::handleUserListDiffCopyRequest, this, _1, _2, _3));
+ registerHandler("RenameUserListDiff", boost::bind(&UserListRequestHandlerGroup::handleUserListDiffRenameRequest, this, _1, _2, _3));
registerHandler("RemoveUserListDiff", boost::bind(&UserListRequestHandlerGroup::handleUserListDiffRemoveRequest, this, _1, _2, _3));
}
diff --git a/src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.h b/src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.h
index 105621b..61f4c7d 100644
--- a/src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.h
+++ b/src/modules/UserListManager/RequestHandlers/UserListRequestHandlerGroup.h
@@ -44,10 +44,14 @@ class MAD_MODULE_EXPORT UserListRequestHandlerGroup : public Common::RequestHan
void handleUserListListRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection);
void handleUserListDownloadRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection);
+ void handleUserListCopyRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection);
+ void handleUserListRenameRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection);
void handleUserListRemoveRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection);
void handleUserListDiffListRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection);
void handleUserListDiffDownloadRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection);
+ void handleUserListDiffCopyRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection);
+ void handleUserListDiffRenameRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection);
void handleUserListDiffRemoveRequest(boost::shared_ptr<const Common::XmlData> packet, Common::XmlData *ret, Common::Connection *connection);
public:
diff --git a/src/modules/UserListManager/UserListManager.cpp b/src/modules/UserListManager/UserListManager.cpp
index e947e24..deb6214 100644
--- a/src/modules/UserListManager/UserListManager.cpp
+++ b/src/modules/UserListManager/UserListManager.cpp
@@ -75,6 +75,14 @@ void UserListManager::storeUserList(const std::string &name, const UserList *lis
application->getStorageManager()->store("UserList", name, &data);
}
+void UserListManager::copyUserList(const std::string &fromName, const std::string &toName) {
+ application->getStorageManager()->copy("UserList", fromName, toName);
+}
+
+void UserListManager::renameUserList(const std::string &fromName, const std::string &toName) {
+ application->getStorageManager()->rename("UserList", fromName, toName);
+}
+
void UserListManager::removeUserList(const std::string &name) {
application->getStorageManager()->remove("UserList", name);
}
@@ -100,6 +108,14 @@ void UserListManager::storeUserListDiff(const std::string &name, const UserListD
application->getStorageManager()->store("UserListDiff", name, &data);
}
+void UserListManager::copyUserListDiff(const std::string &fromName, const std::string &toName) {
+ application->getStorageManager()->copy("UserListDiff", fromName, toName);
+}
+
+void UserListManager::renameUserListDiff(const std::string &fromName, const std::string &toName) {
+ application->getStorageManager()->rename("UserListDiff", fromName, toName);
+}
+
void UserListManager::removeUserListDiff(const std::string &name) {
application->getStorageManager()->remove("UserListDiff", name);
}
diff --git a/src/modules/UserListManager/UserListManager.h b/src/modules/UserListManager/UserListManager.h
index 6d2599b..6763dae 100644
--- a/src/modules/UserListManager/UserListManager.h
+++ b/src/modules/UserListManager/UserListManager.h
@@ -70,6 +70,8 @@ class MAD_MODULE_EXPORT UserListManager : private Core::Configurable, private bo
bool existsUserList(const std::string &name);
boost::shared_ptr<UserList> loadUserList(const std::string &name);
void storeUserList(const std::string &name, const UserList *list);
+ void copyUserList(const std::string &fromName, const std::string &toName);
+ void renameUserList(const std::string &fromName, const std::string &toName);
void removeUserList(const std::string &name);
const std::set<std::string>& getUserListDiffs() const {
@@ -79,6 +81,8 @@ class MAD_MODULE_EXPORT UserListManager : private Core::Configurable, private bo
bool existsUserListDiff(const std::string &name);
boost::shared_ptr<UserListDiff> loadUserListDiff(const std::string &name);
void storeUserListDiff(const std::string &name, const UserListDiff *list);
+ void copyUserListDiff(const std::string &fromName, const std::string &toName);
+ void renameUserListDiff(const std::string &fromName, const std::string &toName);
void removeUserListDiff(const std::string &name);
boost::shared_ptr<UserList> getCurrentUserList();