Kaydet (Commit) 99b7c4f5 authored tarafından Muhammet Kara's avatar Muhammet Kara

tdf#36019: Dynamically enable/disable extension installation via GUI

Now extension installation via the Extension Manager dialog can be
dynamically enabled/disabled from the expert configurations.

This also affects the installation by double-clicking the extension
file in the file manager, but doesn't affect the unopkg commands.

Change-Id: I70c2c83c2458115b366c7fdcc06f72e11df4726b
Reviewed-on: https://gerrit.libreoffice.org/36688Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMuhammet Kara <muhammet.kara@pardus.org.tr>
üst b3f05812
......@@ -20,6 +20,8 @@ $(eval $(call gb_Library_use_external,deploymentgui,boost_headers))
$(eval $(call gb_Library_set_precompiled_header,deploymentgui,$(SRCDIR)/desktop/inc/pch/precompiled_deploymentgui))
$(eval $(call gb_Library_use_custom_headers,deploymentgui,\ officecfg/registry \ ))
$(eval $(call gb_Library_use_sdk_api,deploymentgui))
$(eval $(call gb_Library_use_libraries,deploymentgui,\
......
......@@ -30,6 +30,7 @@
#define RID_STR_WARNING_VERSION_GREATER (RID_DEPLOYMENT_GUI_START + 7)
#define RID_STR_WARNINGBOX_VERSION_GREATER_DIFFERENT_NAMES (RID_DEPLOYMENT_GUI_START + 8)
#define RID_STR_WARNING_INSTALL_EXTENSION (RID_DEPLOYMENT_GUI_START + 9)
#define RID_STR_WARNING_INSTALL_EXTENSION_DISABLED (RID_DEPLOYMENT_GUI_START + 10)
#define RID_DLG_UPDATE_NONE (RID_DEPLOYMENT_GUI_START + 13)
#define RID_DLG_UPDATE_NOINSTALLABLE (RID_DEPLOYMENT_GUI_START + 14)
......
......@@ -113,6 +113,12 @@ String RID_STR_WARNING_INSTALL_EXTENSION
"Click 'Cancel' to stop the installation.";
};
String RID_STR_WARNING_INSTALL_EXTENSION_DISABLED
{
Text [en-US] = "Extension installation is currently disabled. "
"Please consult your system administrator for more information.";
};
String RID_STR_WARNING_REMOVE_EXTENSION
{
Text [en-US] = "You are about to remove the extension '%NAME'.\n"
......
......@@ -71,6 +71,8 @@
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <officecfg/Office/ExtensionManager.hxx>
#include <map>
#include <memory>
#include <vector>
......@@ -419,6 +421,17 @@ void DialogHelper::openWebBrowser( const OUString & sURL, const OUString &sTitle
bool DialogHelper::installExtensionWarn( const OUString &rExtensionName ) const
{
const SolarMutexGuard guard;
// Check if extension installation is disabled in the expert configurations
if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionInstallation::get())
{
ScopedVclPtrInstance<MessageDialog> aWarn(m_pVCLWindow, getResId(RID_STR_WARNING_INSTALL_EXTENSION_DISABLED),
VclMessageType::Warning, VclButtonsType::Ok);
aWarn->Execute();
return false;
}
ScopedVclPtrInstance<MessageDialog> aInfo(m_pVCLWindow, getResId(RID_STR_WARNING_INSTALL_EXTENSION),
VclMessageType::Warning, VclButtonsType::OkCancel);
......@@ -511,6 +524,12 @@ ExtMgrDialog::ExtMgrDialog(vcl::Window *pParent, TheExtensionManager *pManager,
m_pUpdateBtn->Hide();
#endif
if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionInstallation::get())
{
m_pAddBtn->Disable();
m_pAddBtn->SetQuickHelpText(getResId(RID_STR_WARNING_INSTALL_EXTENSION_DISABLED));
}
m_aIdle.SetPriority(TaskPriority::LOWEST);
m_aIdle.SetInvokeHandler( LINK( this, ExtMgrDialog, TimeOutHdl ) );
}
......@@ -804,7 +823,16 @@ IMPL_LINK( ExtMgrDialog, startProgress, void*, _bLockInterface, void )
}
m_pCancelBtn->Enable( bLockInterface );
m_pAddBtn->Enable( !bLockInterface );
m_pAddBtn->Enable( !bLockInterface && !officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionInstallation::get());
if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionInstallation::get())
{
m_pAddBtn->SetQuickHelpText(getResId(RID_STR_WARNING_INSTALL_EXTENSION_DISABLED));
}
else
{
m_pAddBtn->SetQuickHelpText("");
}
m_pUpdateBtn->Enable( !bLockInterface && m_pExtensionBox->getItemCount() );
m_pExtensionBox->enableButtons( !bLockInterface );
......
......@@ -47,6 +47,18 @@
<value/>
</prop>
</group>
<group oor:name="ExtensionSecurity">
<info>
<desc>Holds settings related to Extension security.</desc>
</info>
<prop oor:name="DisableExtensionInstallation" oor:type="xs:boolean" oor:nillable="false">
<info>
<desc>Specifies whether to disable extension installation via the Extension Manager dialog.</desc>
<label>Disable Extension Installation</label>
</info>
<value>false</value>
</prop>
</group>
<group oor:name="ExtensionUpdateData">
<info>
<desc>Contains information about available or ignored updates for extensions."</desc>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment