diff options
author | Pranam Lashkari <lpranam@collabora.com> | 2022-02-10 16:52:47 +0530 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2022-02-11 17:00:11 +0000 |
commit | 7e22a01d4d0a2fe026a4b89f31678706d6148b6f (patch) | |
tree | bfea6e1a5e5cd0cee3707aa8639690b4d4110434 /wsd/DocumentBroker.cpp | |
parent | notebookbar: Send statusbarchanged event after the visibility changed (diff) | |
download | online-7e22a01d4d0a2fe026a4b89f31678706d6148b6f.tar.gz online-7e22a01d4d0a2fe026a4b89f31678706d6148b6f.zip |
refactored feature disabling bits
now it is known as feature locking
Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: I2935edbfe1eb8dcc194641afa2461cf77b2b29d3
Diffstat (limited to 'wsd/DocumentBroker.cpp')
-rw-r--r-- | wsd/DocumentBroker.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp index b90e5d4070..3c17949257 100644 --- a/wsd/DocumentBroker.cpp +++ b/wsd/DocumentBroker.cpp @@ -653,9 +653,8 @@ bool DocumentBroker::download(const std::shared_ptr<ClientSession>& session, con templateSource = wopifileinfo->getTemplateSource(); _isViewFileExtension = COOLWSD::IsViewFileExtension(wopiStorage->getFileExtension()); - if (CommandControl::FreemiumManager::isFreemiumReadOnlyUser() || - !wopifileinfo->getUserCanWrite() || - _isViewFileExtension) + if (CommandControl::LockManager::isLockedReadOnlyUser() || + !wopifileinfo->getUserCanWrite() || _isViewFileExtension) { LOG_DBG("Setting the session as readonly"); session->setReadOnly(); @@ -768,28 +767,29 @@ bool DocumentBroker::download(const std::shared_ptr<ClientSession>& session, con } } -#ifdef ENABLE_FREEMIUM - Object::Ptr freemiumInfo = new Object(); - freemiumInfo->set("IsFreemiumUser", CommandControl::FreemiumManager::isFreemiumUser()); - freemiumInfo->set("IsFreemiumReadOnly", CommandControl::FreemiumManager::isFreemiumReadOnly()); +#ifdef ENABLE_FEATURE_LOCK + Object::Ptr lockInfo = new Object(); + lockInfo->set("IsLockedUser", CommandControl::LockManager::isLockedUser()); + lockInfo->set("IsLockReadOnly", CommandControl::LockManager::isLockReadOnly()); // Poco:Dynamic:Var does not support std::unordred_set so converted to std::vector - std::vector<std::string> freemiumDenyList(CommandControl::FreemiumManager::getFreemiumDenyList().begin(), - CommandControl::FreemiumManager::getFreemiumDenyList().end()); - freemiumInfo->set("FreemiumDenyList", freemiumDenyList); - freemiumInfo->set("FreemiumPurchaseTitle", CommandControl::FreemiumManager::getFreemiumPurchaseTitle()); - freemiumInfo->set("FreemiumPurchaseLink", CommandControl::FreemiumManager::getFreemiumPurchaseLink()); - freemiumInfo->set("FreemiumPurchaseDescription", CommandControl::FreemiumManager::getFreemiumPurchaseDescription()); - freemiumInfo->set("WriterHighlights", CommandControl::FreemiumManager::getWriterHighlights()); - freemiumInfo->set("CalcHighlights", CommandControl::FreemiumManager::getCalcHighlights()); - freemiumInfo->set("ImpressHighlights", CommandControl::FreemiumManager::getImpressHighlights()); - freemiumInfo->set("DrawHighlights", CommandControl::FreemiumManager::getDrawHighlights()); - - std::ostringstream ossFreemiumInfo; - freemiumInfo->stringify(ossFreemiumInfo); - const std::string freemiumInfoString = ossFreemiumInfo.str(); - LOG_TRC("Sending freemium info to client: " << freemiumInfoString); - session->sendMessage("freemium: " + freemiumInfoString); + std::vector<std::string> lockedCommandList( + CommandControl::LockManager::getLockedCommandList().begin(), + CommandControl::LockManager::getLockedCommandList().end()); + lockInfo->set("LockedCommandList", lockedCommandList); + lockInfo->set("UnlockTitle", CommandControl::LockManager::getUnlockTitle()); + lockInfo->set("UnlockLink", CommandControl::LockManager::getUnlockLink()); + lockInfo->set("UnlockDescription", CommandControl::LockManager::getUnlockDescription()); + lockInfo->set("WriterHighlights", CommandControl::LockManager::getWriterHighlights()); + lockInfo->set("CalcHighlights", CommandControl::LockManager::getCalcHighlights()); + lockInfo->set("ImpressHighlights", CommandControl::LockManager::getImpressHighlights()); + lockInfo->set("DrawHighlights", CommandControl::LockManager::getDrawHighlights()); + + std::ostringstream ossLockInfo; + lockInfo->stringify(ossLockInfo); + const std::string lockInfoString = ossLockInfo.str(); + LOG_TRC("Sending feature locking info to client: " << lockInfoString); + session->sendMessage("featurelock: " + lockInfoString); #endif #ifdef ENABLE_FEATURE_RESTRICTION @@ -804,7 +804,7 @@ bool DocumentBroker::download(const std::shared_ptr<ClientSession>& session, con std::ostringstream ossRestrictionInfo; restrictionInfo->stringify(ossRestrictionInfo); const std::string restrictionInfoString = ossRestrictionInfo.str(); - LOG_TRC("Sending freemium info to client: " << restrictionInfoString); + LOG_TRC("Sending command restriction info to client: " << restrictionInfoString); session->sendMessage("restrictedCommands: " + restrictionInfoString); #endif |