more settings to disable import and download of extensions

This commit is contained in:
Uwe Steinmann 2021-09-09 11:42:38 +02:00
parent 9f618c5437
commit da0f5d3053
6 changed files with 54 additions and 6 deletions

View File

@ -4,6 +4,7 @@
- fix sending of some notification mails to groups
- major overhaul of notifications
- check view access for FolderAccess and DocumentAccess
- more settings to disable import and download of extensions
--------------------------------------------------------------------------------
Changes in version 5.1.23

View File

@ -218,6 +218,12 @@ class Settings { /* {{{ */
var $_calendarDefaultView = "y";
// first day of the week (0=sunday, 1=monday, 6=saturday)
var $_firstDayOfWeek = 0;
// enable/disable download of extensions
var $_enableExtensionDownload = true;
// enable/disable import of extensions
var $_enableExtensionImport = true;
// enable/disable import of extensions from repository
var $_enableExtensionImportFromRepository = true;
// enable/disable display of the clipboard
var $_enableClipboard = true;
// enable/disable list of tasks in main menu
@ -521,7 +527,7 @@ class Settings { /* {{{ */
$this->_expandFolderTree = intval($tab["expandFolderTree"]);
$this->_defaultDocPosition = strval($tab["defaultDocPosition"]);
// XML Path: /configuration/site/calendar
// XML Path: /configuration/site/webdav
$node = $xml->xpath('/configuration/site/webdav');
if($node) {
$tab = $node[0]->attributes();
@ -537,6 +543,15 @@ class Settings { /* {{{ */
$this->_firstDayOfWeek = intval($tab["firstDayOfWeek"]);
}
// XML Path: /configuration/site/extensionmgr
$node = $xml->xpath('/configuration/site/extensionmgr');
if($node) {
$tab = $node[0]->attributes();
$this->_enableExtensionDownload = Settings::boolVal($tab["enableExtensionDownload"]);
$this->_enableExtensionImport = Settings::boolVal($tab["enableExtensionImport"]);
$this->_enableExtensionImportFromRepository = Settings::boolVal($tab["enableExtensionImportFromRepository"]);
}
// XML Path: /configuration/system/server
$node = $xml->xpath('/configuration/system/server');
if($node) {
@ -890,7 +905,7 @@ class Settings { /* {{{ */
$this->setXMLAttributValue($node, "sortFoldersDefault", $this->_sortFoldersDefault);
$this->setXMLAttributValue($node, "defaultDocPosition", $this->_defaultDocPosition);
// XML Path: /configuration/site/calendar
// XML Path: /configuration/site/webdav
$node = $this->getXMLNode($xml, '/configuration/site', 'webdav');
$this->setXMLAttributValue($node, "enableWebdavReplaceDoc", $this->_enableWebdavReplaceDoc);
@ -900,6 +915,12 @@ class Settings { /* {{{ */
$this->setXMLAttributValue($node, "calendarDefaultView", $this->_calendarDefaultView);
$this->setXMLAttributValue($node, "firstDayOfWeek", $this->_firstDayOfWeek);
// XML Path: /configuration/site/extensionmgr
$node = $this->getXMLNode($xml, '/configuration/site', 'extensionmgr');
$this->setXMLAttributValue($node, "enableExtensionDownload", $this->_enableExtensionDownload);
$this->setXMLAttributValue($node, "enableExtensionImport", $this->_enableExtensionImport);
$this->setXMLAttributValue($node, "enableExtensionImportFromRepository", $this->_enableExtensionImportFromRepository);
// XML Path: /configuration/system/server
$this->getXMLNode($xml, '/configuration', 'system');
$node = $this->getXMLNode($xml, '/configuration/system', 'server');

View File

@ -45,6 +45,9 @@ else $currenttab=NULL;
// Download extension -------------------------------------------------------
if ($action == "download") { /* {{{ */
if(!$settings->_enableExtensionDownload) {
UI::exitError(getMLText("admin_tools"),getMLText("access_denied"));
}
if (!isset($_POST["extname"])) {
UI::exitError(getMLText("admin_tools"),getMLText("unknown_id"));
}
@ -72,6 +75,9 @@ elseif ($action == "refresh") { /* {{{ */
header("Location:../out/out.ExtensionMgr.php?currenttab=".$currenttab);
} /* }}} */
elseif ($action == "upload") { /* {{{ */
if(!$settings->_enableExtensionImport) {
UI::exitError(getMLText("admin_tools"),getMLText("extension_mgr_upload_disabled"));
}
if(!$extMgr->isWritableExtDir()) {
UI::exitError(getMLText("admin_tools"),getMLText("extension_mgr_no_upload"));
}
@ -92,6 +98,9 @@ elseif ($action == "upload") { /* {{{ */
header("Location:../out/out.ExtensionMgr.php?currenttab=".$currenttab);
} /* }}} */
elseif ($action == "import") { /* {{{ */
if(!$settings->_enableExtensionImportFromRepository) {
UI::exitError(getMLText("admin_tools"),getMLText("extension_mgr_upload_disabled"));
}
if(!$_POST['url']) {
UI::exitError(getMLText("admin_tools"),getMLText("error_occured"));
}

View File

@ -158,6 +158,11 @@ if ($action == "saveSettings")
setStrValue("calendarDefaultView");
setIntValue("firstDayOfWeek");
// SETTINGS - SITE - EXTENSIONMGR
setBoolValue("enableExtensionDownload");
setBoolValue("enableExtensionImport");
setBoolValue("enableExtensionImportFromRepository");
// SETTINGS - SYSTEM - SERVER
setDirValue("rootDir");
setStrValue("httpRoot");

View File

@ -218,7 +218,8 @@ class SeedDMS_View_ExtensionMgr extends SeedDMS_Theme_Style {
}
if($extconf['config'])
echo "<a href=\"../out/out.Settings.php?currenttab=extensions#".$extname."\" title=\"".getMLText('configure_extension')."\"><i class=\"fa fa-cogs\"></i></a>";
echo "<form style=\"display: inline-block; margin: 0px;\" method=\"post\" action=\"../op/op.ExtensionMgr.php\" id=\"".$extname."-download\">".createHiddenFieldWithKey('extensionmgr')."<input type=\"hidden\" name=\"action\" value=\"download\" /><input type=\"hidden\" name=\"extname\" value=\"".$extname."\" /><a class=\"download\" data-extname=\"".$extname."\" title=\"".getMLText('download_extension')."\"><i class=\"fa fa-download\"></i></a></form>";
if($settings->_enableExtensionDownload)
echo "<form style=\"display: inline-block; margin: 0px;\" method=\"post\" action=\"../op/op.ExtensionMgr.php\" id=\"".$extname."-download\">".createHiddenFieldWithKey('extensionmgr')."<input type=\"hidden\" name=\"action\" value=\"download\" /><input type=\"hidden\" name=\"extname\" value=\"".$extname."\" /><a class=\"download\" data-extname=\"".$extname."\" title=\"".getMLText('download_extension')."\"><i class=\"fa fa-download\"></i></a></form>";
if(!$settings->extensionIsDisabled($extname)) {
echo ' <a href="#" class="toggle" data-extname="'.$extname.'" title="'.getMLText('disable_extension').'"><i class="fa fa-check"</i></a>';
} else {
@ -250,7 +251,7 @@ class SeedDMS_View_ExtensionMgr extends SeedDMS_Theme_Style {
$this->contentHeading(getMLText("extension_manager"));
$this->rowStart();
$this->columnStart(4);
if($extmgr->isWritableExtDir()) {
if($settings->_enableExtensionImport && $extmgr->isWritableExtDir()) {
?>
<form class="form-horizontal" method="post" enctype="multipart/form-data" action="../op/op.ExtensionMgr.php">
<?= createHiddenFieldWithKey('extensionmgr') ?>
@ -265,7 +266,10 @@ class SeedDMS_View_ExtensionMgr extends SeedDMS_Theme_Style {
</form>
<?php
} else {
echo "<div class=\"alert alert-warning\">".getMLText('extension_mgr_no_upload')."</div>";
if($settings->_enableExtensionImport)
echo "<div class=\"alert alert-warning\">".getMLText('extension_mgr_no_upload')."</div>";
else
echo "<div class=\"alert alert-warning\">".getMLText('extension_mgr_upload_disabled')."</div>";
}
$this->columnEnd();
$this->columnStart(8);
@ -324,7 +328,7 @@ class SeedDMS_View_ExtensionMgr extends SeedDMS_Theme_Style {
echo "<div class=\"list-action\">";
echo $this->getModalBoxLink(array('target'=>'extensionInfo', 'remote'=>'out.ExtensionMgr.php?action=info_versions&extensionname='.$re['name'], 'class'=>'', 'title'=>'<i class="fa fa-list-ol"></i>'));
echo $this->getModalBoxLink(array('target'=>'extensionChangelog', 'remote'=>'out.ExtensionMgr.php?action=info_changelog&extensionname='.$re['name'], 'class'=>'', 'title'=>'<i class="fa fa-reorder"></i>'));
if(!$checkmsgs && $extmgr->isWritableExtDir())
if(!$checkmsgs && $settings->_enableExtensionImportFromRepository && $extmgr->isWritableExtDir())
echo "<form style=\"display: inline-block; margin: 0px;\" method=\"post\" action=\"../op/op.ExtensionMgr.php\" id=\"".$re['name']."-import\">".createHiddenFieldWithKey('extensionmgr')."<input type=\"hidden\" name=\"action\" value=\"import\" /><input type=\"hidden\" name=\"currenttab\" value=\"repository\" /><input type=\"hidden\" name=\"url\" value=\"".$re['filename']."\" /><a class=\"import\" data-extname=\"".$re['name']."\" title=\"".getMLText('import_extension')."\"><i class=\"fa fa-download\"></i></a></form>";
echo "</div>";
echo "</td>";

View File

@ -371,6 +371,14 @@ if(($kkk = $this->callHook('getFullSearchEngine')) && is_array($kkk))
<?php $this->showConfigCheckbox('settings_enableCalendar', 'enableCalendar'); ?>
<?php $this->showConfigOption('settings_calendarDefaultView', 'calendarDefaultView', array('w'=>'week_view', 'm'=>'month_view', 'y'=>'year_view'), false, true); ?>
<?php $this->showConfigOption('settings_firstDayOfWeek', 'firstDayOfWeek', array(' 0'=>'sunday', ' 1'=>'monday', ' 2'=>'tuesday', ' 3'=>'wednesday', ' 4'=>'thursday', ' 5'=>'friday', ' 6'=>'saturday'), false, true); ?>
<!--
-- SETTINGS - SITE - EXTENSIONMGR
-->
<?php $this->showConfigHeadline('settings_ExtensionMgr'); ?>
<?php $this->showConfigCheckbox('settings_enableExtensionDownload', 'enableExtensionDownload'); ?>
<?php $this->showConfigCheckbox('settings_enableExtensionImport', 'enableExtensionImport'); ?>
<?php $this->showConfigCheckbox('settings_enableExtensionImportFromRepository', 'enableExtensionImportFromRepository'); ?>
<?php
$this->showEndPaneContent('site', $currenttab);