From 6ecb90628fbb04cd53b972fb564f88aa9feeb428 Mon Sep 17 00:00:00 2001 From: Belle Aerni Date: Tue, 8 Aug 2023 00:39:15 -0700 Subject: [PATCH] Prevent actions on hosting services with bad order status (#1521) --- src/modules/Servicehosting/Service.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/modules/Servicehosting/Service.php b/src/modules/Servicehosting/Service.php index 1f56ed51c..188ecfdb0 100644 --- a/src/modules/Servicehosting/Service.php +++ b/src/modules/Servicehosting/Service.php @@ -379,9 +379,17 @@ class Service implements InjectionAwareInterface return null; } - private function _performOnService(\Model_ClientOrder $order) + private function _performOnService(\Model_ClientOrder $order): bool { - return $order->status != \Model_ClientOrder::STATUS_FAILED_SETUP; + // If the order matches any of the following status, we should prevent actions such as PW resets or username changes from being performed + $badStatus = [ + \Model_ClientOrder::STATUS_FAILED_SETUP, + \Model_ClientOrder::STATUS_PENDING_SETUP, + \Model_ClientOrder::STATUS_SUSPENDED, + \Model_ClientOrder::STATUS_CANCELED, + ]; + + return !in_array($order->status, $badStatus); } private function _getServerMangerForOrder($model)