From 237af23690cf618d94817e759ad75e860d316bec Mon Sep 17 00:00:00 2001 From: netkas Date: Tue, 3 Jun 2025 01:04:44 -0400 Subject: [PATCH] Add LIST_OPERATORS case to handle operator listing requests --- src/FederationServer/Classes/Enums/Method.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/FederationServer/Classes/Enums/Method.php b/src/FederationServer/Classes/Enums/Method.php index ae51264..bf2910b 100644 --- a/src/FederationServer/Classes/Enums/Method.php +++ b/src/FederationServer/Classes/Enums/Method.php @@ -16,6 +16,7 @@ enum Method { + case LIST_OPERATORS; case CREATE_OPERATOR; case DELETE_OPERATOR; case ENABLE_OPERATOR; @@ -38,6 +39,10 @@ { switch($this) { + case self::LIST_OPERATORS: + // This method does not have a dedicated handler, it is handled by the main request handler + // in FederationServer::handleRequest() + break; case self::GET_OPERATOR: GetOperator::handleRequest(); break; @@ -86,8 +91,9 @@ $requestMethod === 'POST' && $path === '/' => null, preg_match('#^/attachment/([a-fA-F0-9\-]{36,})$#', $path) => Method::DOWNLOAD_ATTACHMENT, - ($requestMethod === 'POST' | $requestMethod === 'PUT') && $path === '/attachment/upload' => Method::UPLOAD_ATTACHMENT, + ($requestMethod === 'POST' || $requestMethod === 'PUT') && $path === '/attachment/upload' => Method::UPLOAD_ATTACHMENT, + ($requestMethod === 'POST' || $requestMethod === 'GET') && $path === '/operators' => Method::LIST_OPERATORS, $requestMethod === 'POST' && $path === '/operators/create' => Method::CREATE_OPERATOR, preg_match('#^/operators/([a-fA-F0-9\-]{36,})$#', $path) && $requestMethod === 'POST' => Method::GET_OPERATOR, preg_match('#^/operators/([a-fA-F0-9\-]{36,})/delete$#', $path) && $requestMethod === 'DELETE' => Method::DELETE_OPERATOR,