From 5de30bfc6239d9a4072b743b2dac29c079763176 Mon Sep 17 00:00:00 2001 From: sv3n Date: Thu, 18 Aug 2022 00:57:04 +0200 Subject: [PATCH] Added a configuration flag to disable global search in adminhtml (#2443) --- README.md | 11 +++++------ .../Adminhtml/controllers/IndexController.php | 2 +- app/code/core/Mage/Adminhtml/etc/config.xml | 3 +++ app/code/core/Mage/Core/etc/system.xml | 19 +++++++++++++++++++ .../default/template/page/header.phtml | 2 +- .../openmage/template/page/header.phtml | 2 +- 6 files changed, 30 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b3f23b13643..4aac659c812 100644 --- a/README.md +++ b/README.md @@ -103,17 +103,16 @@ Most important changes will be listed here, all other changes since `19.4.0` can ### Between Magento 1.9.4.5 and OpenMage 19.x - bug fixes and PHP 7.x and 8.0 compatibility -- added config cache for system.xml #1916 +- added config cache for system.xml [#1916](https://github.com/OpenMage/magento-lts/pull/1916) ### Between OpenMage 19.x and 20.x Do not use 20.x.x if you need IE support. -- removed IE conditional comments, IE styles, IE scripts and IE eot files #1073 -- removed frontend default themes (default, modern, iphone, german, french, blank, blue) #1600 -- fixed incorrect datetime in customer block (`$useTimezone` parameter) #1525 -- add redis as a valid option for `global/session_save` #1513 -- possibility to disable global search in backend #1532 +- removed IE conditional comments, IE styles, IE scripts and IE eot files [#1073](https://github.com/OpenMage/magento-lts/pull/1073) +- removed frontend default themes (default, modern, iphone, german, french, blank, blue) [#1600](https://github.com/OpenMage/magento-lts/pull/1600) +- fixed incorrect datetime in customer block (`$useTimezone` parameter) [#1525](https://github.com/OpenMage/magento-lts/pull/1525) +- add redis as a valid option for `global/session_save` [#1513](https://github.com/OpenMage/magento-lts/pull/1513) For full list of changes, you can [compare tags](https://github.com/OpenMage/magento-lts/compare/1.9.4.x...20.0). diff --git a/app/code/core/Mage/Adminhtml/controllers/IndexController.php b/app/code/core/Mage/Adminhtml/controllers/IndexController.php index 2f48729e5cc..f1c8d2c97bc 100644 --- a/app/code/core/Mage/Adminhtml/controllers/IndexController.php +++ b/app/code/core/Mage/Adminhtml/controllers/IndexController.php @@ -98,7 +98,7 @@ public function globalSearchAction() $searchModules = Mage::getConfig()->getNode("adminhtml/global_search"); $items = array(); - if (!Mage::getSingleton('admin/session')->isAllowed('admin/global_search')) { + if (!Mage::getStoreConfigFlag('admin/global_search/enable') || !Mage::getSingleton('admin/session')->isAllowed('admin/global_search')) { $items[] = array( 'id' => 'error', 'type' => Mage::helper('adminhtml')->__('Error'), diff --git a/app/code/core/Mage/Adminhtml/etc/config.xml b/app/code/core/Mage/Adminhtml/etc/config.xml index 7c12b63a6f9..b721908fd82 100644 --- a/app/code/core/Mage/Adminhtml/etc/config.xml +++ b/app/code/core/Mage/Adminhtml/etc/config.xml @@ -231,6 +231,9 @@ 0 + + 1 + diff --git a/app/code/core/Mage/Core/etc/system.xml b/app/code/core/Mage/Core/etc/system.xml index e3943cdfd00..df9b49ca33f 100644 --- a/app/code/core/Mage/Core/etc/system.xml +++ b/app/code/core/Mage/Core/etc/system.xml @@ -1063,6 +1063,25 @@ + + + 1 + 0 + 0 + 6 + + + + select + adminhtml/system_config_source_yesno + 1 + 1 + 0 + 0 + + + + 10 diff --git a/app/design/adminhtml/default/default/template/page/header.phtml b/app/design/adminhtml/default/default/template/page/header.phtml index b38f0b02834..6086f1a05be 100644 --- a/app/design/adminhtml/default/default/template/page/header.phtml +++ b/app/design/adminhtml/default/default/template/page/header.phtml @@ -26,7 +26,7 @@

__("Logged in as %s", $this->escapeHtml($this->getUser()->getUsername())) ?>|__('Log Out') ?>

- isAllowed('admin/global_search') ): ?> + isAllowed('admin/global_search')): ?>
Search