summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuhammet Kara <muhammet.kara@pardus.org.tr>2017-05-22 11:41:20 +0300
committerKatarina Behrens <Katarina.Behrens@cib.de>2017-06-09 10:24:53 +0200
commit5cae6a08a13ab0842826989eb5b840746be494a2 (patch)
treef242c60ebb9c2fc6de32241f6b9139d0c2b3d1d9
parent430e2d0d087ec981e59e0962bc029717481ee753 (diff)
tdf#36019: Enable/disable extension installation and removal via GUI
Now extension installation and removal 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. When ExtensionSecurity::DisableExtensionRemoval is set in expert configurations, context menu entry of 'remove' for installed extensions is also disabled along with the "Remove" button on the dialog. This is the combination of 4 commits from master: 99b7c4f57d7f f09be32d0fcb 99841f1fd2bf 18cf49580846 Change-Id: Ide7b8bcae750b093bcc0a98948845273611cd620 Reviewed-on: https://gerrit.libreoffice.org/38455 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Muhammet Kara <muhammet.kara@pardus.org.tr>
-rw-r--r--desktop/Library_deploymentgui.mk2
-rw-r--r--desktop/inc/dp_gui.hrc2
-rw-r--r--desktop/source/deployment/gui/dp_gui_dialog.src12
-rw-r--r--desktop/source/deployment/gui/dp_gui_dialog2.cxx51
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/ExtensionManager.xcs19
5 files changed, 83 insertions, 3 deletions
diff --git a/desktop/Library_deploymentgui.mk b/desktop/Library_deploymentgui.mk
index a16b567ea5d4..0a92e54d9907 100644
--- a/desktop/Library_deploymentgui.mk
+++ b/desktop/Library_deploymentgui.mk
@@ -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,\
diff --git a/desktop/inc/dp_gui.hrc b/desktop/inc/dp_gui.hrc
index 9bb961474743..a22629cb1e7a 100644
--- a/desktop/inc/dp_gui.hrc
+++ b/desktop/inc/dp_gui.hrc
@@ -30,6 +30,8 @@
#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_STR_WARNING_REMOVE_EXTENSION_DISABLED (RID_DEPLOYMENT_GUI_START + 11)
#define RID_DLG_UPDATE_NONE (RID_DEPLOYMENT_GUI_START + 13)
#define RID_DLG_UPDATE_NOINSTALLABLE (RID_DEPLOYMENT_GUI_START + 14)
diff --git a/desktop/source/deployment/gui/dp_gui_dialog.src b/desktop/source/deployment/gui/dp_gui_dialog.src
index 9078a353533a..27ebb4b7f6f1 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog.src
+++ b/desktop/source/deployment/gui/dp_gui_dialog.src
@@ -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"
@@ -120,6 +126,12 @@ String RID_STR_WARNING_REMOVE_EXTENSION
"Click 'Cancel' to stop removing the extension.";
};
+String RID_STR_WARNING_REMOVE_EXTENSION_DISABLED
+{
+ Text [en-US] = "Extension removal is currently disabled. "
+ "Please consult your system administrator for more information.";
+};
+
String RID_STR_WARNING_REMOVE_SHARED_EXTENSION
{
Text [en-US] = "Make sure that no further users are working with the same "
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
index dc75acbb8264..ba9cc08f995b 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
@@ -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>
@@ -261,7 +263,10 @@ MENU_COMMAND ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const long
else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE )
aPopup->InsertItem( CMD_ENABLE, DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) );
}
- aPopup->InsertItem( CMD_REMOVE, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) );
+ if (!officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionRemoval::get())
+ {
+ aPopup->InsertItem( CMD_REMOVE, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) );
+ }
}
if ( !GetEntryData( nPos )->m_sLicenseText.isEmpty() )
@@ -419,6 +424,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 +527,17 @@ 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));
+ }
+ if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionRemoval::get())
+ {
+ m_pRemoveBtn->Disable();
+ m_pRemoveBtn->SetQuickHelpText(getResId(RID_STR_WARNING_REMOVE_EXTENSION_DISABLED));
+ }
+
m_aIdle.SetPriority(TaskPriority::LOWEST);
m_aIdle.SetInvokeHandler( LINK( this, ExtMgrDialog, TimeOutHdl ) );
}
@@ -739,7 +766,16 @@ void ExtMgrDialog::enableOptionsButton( bool bEnable )
void ExtMgrDialog::enableRemoveButton( bool bEnable )
{
- m_pRemoveBtn->Enable( bEnable );
+ m_pRemoveBtn->Enable( bEnable && !officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionRemoval::get());
+
+ if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionRemoval::get())
+ {
+ m_pRemoveBtn->SetQuickHelpText(getResId(RID_STR_WARNING_REMOVE_EXTENSION_DISABLED));
+ }
+ else
+ {
+ m_pRemoveBtn->SetQuickHelpText("");
+ }
}
void ExtMgrDialog::enableEnableButton( bool bEnable )
@@ -804,7 +840,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 );
diff --git a/officecfg/registry/schema/org/openoffice/Office/ExtensionManager.xcs b/officecfg/registry/schema/org/openoffice/Office/ExtensionManager.xcs
index 893fd882ac37..eaf840cd90e4 100644
--- a/officecfg/registry/schema/org/openoffice/Office/ExtensionManager.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/ExtensionManager.xcs
@@ -47,6 +47,25 @@
<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>
+ <prop oor:name="DisableExtensionRemoval" oor:type="xs:boolean" oor:nillable="false">
+ <info>
+ <desc>Specifies whether to disable extension removal via the Extension Manager dialog.</desc>
+ <label>Disable Extension Removal</label>
+ </info>
+ <value>false</value>
+ </prop>
+ </group>
<group oor:name="ExtensionUpdateData">
<info>
<desc>Contains information about available or ignored updates for extensions."</desc>