summaryrefslogtreecommitdiffstats
path: root/wsd/AdminModel.cpp
diff options
context:
space:
mode:
authorAditya Dewan <iit2015097@iiita.ac.in>2017-06-23 18:02:44 +0530
committerpranavk <pranavk@collabora.co.uk>2017-07-06 09:18:09 +0200
commitbc7fa9a8120a5fb94ff032785186f4453416ab3a (patch)
treea1c2452d06ce5f859ff5cd2a5fe50af9ed489dff /wsd/AdminModel.cpp
parentAssign unique editorId to localhost users (diff)
downloadonline-bc7fa9a8120a5fb94ff032785186f4453416ab3a.tar.gz
online-bc7fa9a8120a5fb94ff032785186f4453416ab3a.zip
admin: convert document list to drop down
Change-Id: I23635599b008fb0bfa694b4e73cb8f18f49c8ab7 Reviewed-on: https://gerrit.libreoffice.org/39170 Reviewed-by: pranavk <pranavk@collabora.co.uk> Tested-by: pranavk <pranavk@collabora.co.uk>
Diffstat (limited to 'wsd/AdminModel.cpp')
-rw-r--r--wsd/AdminModel.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/wsd/AdminModel.cpp b/wsd/AdminModel.cpp
index 26097fd053..440de191c5 100644
--- a/wsd/AdminModel.cpp
+++ b/wsd/AdminModel.cpp
@@ -26,9 +26,9 @@
#include "Unit.hpp"
#include "Util.hpp"
-void Document::addView(const std::string& sessionId, const std::string& userName)
+void Document::addView(const std::string& sessionId, const std::string& userName, const std::string& userId)
{
- const auto ret = _views.emplace(sessionId, View(sessionId, userName));
+ const auto ret = _views.emplace(sessionId, View(sessionId, userName, userId));
if (!ret.second)
{
LOG_WRN("View with SessionID [" << sessionId << "] already exists.");
@@ -464,17 +464,19 @@ void AdminModel::modificationAlert(const std::string& docKey, Poco::Process::PID
void AdminModel::addDocument(const std::string& docKey, Poco::Process::PID pid,
const std::string& filename, const std::string& sessionId,
- const std::string& userName)
+ const std::string& userName, const std::string& userId)
{
assertCorrectThread();
const auto ret = _documents.emplace(docKey, Document(docKey, pid, filename));
ret.first->second.takeSnapshot();
- ret.first->second.addView(sessionId, userName);
+ ret.first->second.addView(sessionId, userName, userId);
LOG_DBG("Added admin document [" << docKey << "].");
std::string encodedUsername;
std::string encodedFilename;
+ std::string encodedUserId;
+ Poco::URI::encode(userId, " ", encodedUserId);
Poco::URI::encode(filename, " ", encodedFilename);
Poco::URI::encode(userName, " ", encodedUsername);
@@ -484,7 +486,8 @@ void AdminModel::addDocument(const std::string& docKey, Poco::Process::PID pid,
<< pid << ' '
<< encodedFilename << ' '
<< sessionId << ' '
- << encodedUsername << ' ';
+ << encodedUsername << ' '
+ << encodedUserId << ' ';
// We have to wait until the kit sends us its PSS.
// Here we guestimate until we get an update.
@@ -656,6 +659,7 @@ std::string AdminModel::getDocuments() const
if(!viewIt.second.isExpired()) {
oss << separator << '{'
<< "\"userName\"" << ':' << '"' << viewIt.second.getUserName() << '"' << ','
+ << "\"userId\"" << ':' << '"' << viewIt.second.getUserId() << '"' << ','
<< "\"sessionid\"" << ':' << '"' << viewIt.second.getSessionId() << '"' << '}';
separator = ',';
}