[Libreoffice-commits] online.git: 2 commits - wsd/Storage.cpp wsd/Storage.hpp
Michael Meeks (via logerrit)
logerrit at kemper.freedesktop.org
Wed Nov 20 16:03:44 UTC 2019
wsd/Storage.cpp | 47 ++++++++++++++++++++---------------------------
wsd/Storage.hpp | 6 ++++++
2 files changed, 26 insertions(+), 27 deletions(-)
New commits:
commit d4b71cb73d4f9ca081f62f1a137d9b0cec6ed6f6
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Tue Nov 19 21:23:50 2019 +0000
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Wed Nov 20 15:41:06 2019 +0000
Share code for reuse_cookies handling.
Change-Id: I9e4d66f14b46284c8d4f33173f028f0bcea34be2
diff --git a/wsd/Storage.cpp b/wsd/Storage.cpp
index 367770a6d..5569763ee 100644
--- a/wsd/Storage.cpp
+++ b/wsd/Storage.cpp
@@ -445,15 +445,8 @@ static void addStorageReuseCookie(Poco::Net::HTTPRequest& request, const std::st
}
}
-} // anonymous namespace
-
-std::unique_ptr<WopiStorage::WOPIFileInfo> WopiStorage::getWOPIFileInfo(const Authorization& auth)
+std::string getReuseCookies(const Poco::URI &uriObject)
{
- // update the access_token to the one matching to the session
- Poco::URI uriObject(getUri());
- auth.authorizeURI(uriObject);
- const std::string uriAnonym = LOOLWSD::anonymizeUrl(uriObject.toString());
-
std::string reuseStorageCookies;
for (const auto& param : uriObject.getQueryParameters())
{
@@ -463,6 +456,18 @@ std::unique_ptr<WopiStorage::WOPIFileInfo> WopiStorage::getWOPIFileInfo(const Au
break;
}
}
+ return reuseStorageCookies;
+}
+
+} // anonymous namespace
+
+std::unique_ptr<WopiStorage::WOPIFileInfo> WopiStorage::getWOPIFileInfo(const Authorization& auth)
+{
+ // update the access_token to the one matching to the session
+ Poco::URI uriObject(getUri());
+ auth.authorizeURI(uriObject);
+ const std::string uriAnonym = LOOLWSD::anonymizeUrl(uriObject.toString());
+ std::string reuseStorageCookies = getReuseCookies(uriObject);
LOG_DBG("Getting info for wopi uri [" << uriAnonym << "].");
@@ -671,15 +676,7 @@ std::string WopiStorage::loadStorageFileToLocal(const Authorization& auth, const
uriObject.setPath(uriObject.getPath() + "/contents");
auth.authorizeURI(uriObject);
- std::string reuseStorageCookies;
- for (const auto& param : uriObject.getQueryParameters())
- {
- if (param.first == "reuse_cookies")
- {
- reuseStorageCookies = param.second;
- break;
- }
- }
+ std::string reuseStorageCookies = getReuseCookies(uriObject);
Poco::URI uriObjectAnonym(getUri());
uriObjectAnonym.setPath(LOOLWSD::anonymizeUrl(uriObjectAnonym.getPath()) + "/contents");
@@ -775,15 +772,7 @@ StorageBase::SaveResult WopiStorage::saveLocalFileToStorage(const Authorization&
uriObject.setPath(isSaveAs || isRename? uriObject.getPath(): uriObject.getPath() + "/contents");
auth.authorizeURI(uriObject);
- std::string reuseStorageCookies;
- for (const auto& param : uriObject.getQueryParameters())
- {
- if (param.first == "reuse_cookies")
- {
- reuseStorageCookies = param.second;
- break;
- }
- }
+ std::string reuseStorageCookies = getReuseCookies(uriObject);
const std::string uriAnonym = LOOLWSD::anonymizeUrl(uriObject.toString());
commit 68d81dae49dfbe0b0351f625e4e7b5bf5ee031ec
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Tue Nov 19 20:54:29 2019 +0000
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Wed Nov 20 15:41:06 2019 +0000
Read and store SupportsLocks property.
Change-Id: Ic405dfa5f6e759937094835f41787fa2cbe29f49
diff --git a/wsd/Storage.cpp b/wsd/Storage.cpp
index b6ca49e02..367770a6d 100644
--- a/wsd/Storage.cpp
+++ b/wsd/Storage.cpp
@@ -538,6 +538,7 @@ std::unique_ptr<WopiStorage::WOPIFileInfo> WopiStorage::getWOPIFileInfo(const Au
bool userCanNotWriteRelative = true;
bool enableInsertRemoteImage = false;
bool enableShare = false;
+ bool supportsLocks = false;
bool supportsRename = false;
bool userCanRename = false;
std::string hideUserList("false");
@@ -625,6 +626,7 @@ std::unique_ptr<WopiStorage::WOPIFileInfo> WopiStorage::getWOPIFileInfo(const Au
JsonUtil::findJSONValue(object, "EnableInsertRemoteImage", enableInsertRemoteImage);
JsonUtil::findJSONValue(object, "EnableShare", enableShare);
JsonUtil::findJSONValue(object, "HideUserList", hideUserList);
+ JsonUtil::findJSONValue(object, "SupportsLocks", supportsLocks);
JsonUtil::findJSONValue(object, "SupportsRename", supportsRename);
JsonUtil::findJSONValue(object, "UserCanRename", userCanRename);
bool booleanFlag = false;
@@ -656,7 +658,8 @@ std::unique_ptr<WopiStorage::WOPIFileInfo> WopiStorage::getWOPIFileInfo(const Au
enableOwnerTermination, disablePrint, disableExport, disableCopy,
disableInactiveMessages, downloadAsPostMessage, userCanNotWriteRelative, enableInsertRemoteImage, enableShare,
hideUserList, disableChangeTrackingShow, disableChangeTrackingRecord,
- hideChangeTrackingControls, supportsRename, userCanRename, callDuration}));
+ hideChangeTrackingControls, supportsLocks, supportsRename,
+ userCanRename, callDuration}));
}
/// uri format: http://server/<...>/wopi*/files/<id>/content
@@ -743,6 +746,7 @@ std::string WopiStorage::loadStorageFileToLocal(const Authorization& auth, const
uriAnonym << "] -> " << getRootFilePathAnonym() << " in " << diff.count() << "s");
setLoaded(true);
+
// Now return the jailed path.
return Poco::Path(getJailPath(), getFileInfo().getFilename()).toString();
}
diff --git a/wsd/Storage.hpp b/wsd/Storage.hpp
index 6bb57a72a..3632cd6f3 100644
--- a/wsd/Storage.hpp
+++ b/wsd/Storage.hpp
@@ -347,6 +347,7 @@ public:
const TriState disableChangeTrackingShow,
const TriState disableChangeTrackingRecord,
const TriState hideChangeTrackingControls,
+ const bool supportsLocks,
const bool supportsRename,
const bool userCanRename,
const std::chrono::duration<double> callDuration)
@@ -374,6 +375,7 @@ public:
_disableChangeTrackingShow(disableChangeTrackingShow),
_disableChangeTrackingRecord(disableChangeTrackingRecord),
_hideChangeTrackingControls(hideChangeTrackingControls),
+ _supportsLocks(supportsLocks),
_supportsRename(supportsRename),
_userCanRename(userCanRename),
_callDuration(callDuration)
@@ -427,6 +429,8 @@ public:
bool getSupportsRename() const { return _supportsRename; }
+ bool getSupportsLocks() const { return _supportsLocks; }
+
bool getUserCanRename() const { return _userCanRename; }
std::string& getHideUserList() { return _hideUserList; }
@@ -492,6 +496,8 @@ public:
TriState _disableChangeTrackingRecord;
/// If we should hide change-tracking commands for this user.
TriState _hideChangeTrackingControls;
+ /// If WOPI host supports locking
+ bool _supportsLocks;
/// If WOPI host supports rename
bool _supportsRename;
/// If user is allowed to rename the document
More information about the Libreoffice-commits
mailing list