From d86dc28dbbb900dbaf9fd928c16609fbb824d530 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 19 Feb 2025 14:43:08 +1300 Subject: [PATCH] NEW Add ActivateSudoModeServiceExtension --- README.md | 9 ++++++++ .../ActivateSudoModeServiceExtension.php | 22 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 src/Extensions/ActivateSudoModeServiceExtension.php diff --git a/README.md b/README.md index ed2cc83d..933d0226 100644 --- a/README.md +++ b/README.md @@ -754,6 +754,15 @@ for example to cast any argument matching the `\d` regex into an actual PHP inte [strtotime()](http://www.php.net/manual/en/datetime.formats.relative.php). Example: "the datetime of 2 days ago" might return "2013-10-10 23:00:00" if its currently the 12th of October 2013. +### Disabling sudo mode + +The activate mode sudo extension will disable sudo mode so that you do not need to re-enter your password for any +data protected by sudo mode. + +```cucumber + Given I add an extension "SilverStripe\BehatExtension\Extensions\ActivateSudoModeServiceExtension" to the "SilverStripe\Security\SudoMode\SudoModeService" class +``` + ## Useful resources * [Silverstripe CMS architecture](https://docs.silverstripe.org/sapphire/en/trunk/reference/cms-architecture) diff --git a/src/Extensions/ActivateSudoModeServiceExtension.php b/src/Extensions/ActivateSudoModeServiceExtension.php new file mode 100644 index 00000000..7eb5f0f0 --- /dev/null +++ b/src/Extensions/ActivateSudoModeServiceExtension.php @@ -0,0 +1,22 @@ + + */ +class ActivateSudoModeServiceExtension extends Extension +{ + public function updateCheck(bool &$active, Session $session) + { + $active = true; + } +}