summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorPranam Lashkari <lpranam@collabora.com>2021-09-13 23:05:40 +0530
committerMiklos Vajna <vmiklos@collabora.com>2021-10-22 12:49:56 +0200
commit8de04f459611df936c0b315b6d48cb3dbcc1d5fa (patch)
treed0ba32ac0b7422b28e9db8525c9ca62de110d62a /comphelper
parent751fa45b1780f275a7b8fdce52a2fd722e87fcb7 (diff)
LOK: introduce way to restrict uno commands
With this new API we can define which uno commands to restrict their functionality Conflicts: desktop/qa/desktop_lib/test_desktop_lib.cxx include/LibreOfficeKit/LibreOfficeKit.h include/LibreOfficeKit/LibreOfficeKit.hxx include/sfx2/viewsh.hxx Change-Id: I9f3fd659d373e56542c5323922a53564f1cfb27b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124046 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/source/misc/lok.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx
index c7c57cb61e27..c4ab97ed2f06 100644
--- a/comphelper/source/misc/lok.cxx
+++ b/comphelper/source/misc/lok.cxx
@@ -37,6 +37,8 @@ static Compat g_eCompatFlags(Compat::none);
static std::vector<OUString> g_vFreemiumDenyList;
+static std::vector<OUString> g_vRestrictedCommandList;
+
namespace
{
@@ -310,6 +312,31 @@ bool isCommandFreemiumDenied(const OUString& command)
return std::find(g_vFreemiumDenyList.begin(), g_vFreemiumDenyList.end(), command) != g_vFreemiumDenyList.end();
}
+void setRestrictedCommandList(const char* restrictedCommandList)
+{
+ if(!g_vRestrictedCommandList.empty())
+ return;
+
+ OUString RestrictedListString(restrictedCommandList, strlen(restrictedCommandList), RTL_TEXTENCODING_UTF8);
+
+ OUString command = RestrictedListString.getToken(0, ' ');
+ for (size_t i = 1; !command.isEmpty(); i++)
+ {
+ g_vRestrictedCommandList.emplace_back(command);
+ command = RestrictedListString.getToken(i, ' ');
+ }
+}
+
+const std::vector<OUString>& getRestrictedCommandList()
+{
+ return g_vRestrictedCommandList;
+}
+
+bool isRestrictedCommand(const OUString& command)
+{
+ return std::find(g_vRestrictedCommandList.begin(), g_vRestrictedCommandList.end(), command) != g_vRestrictedCommandList.end();
+}
+
} // namespace
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */