From 13e98dce15b0b51fc16086840e677beed34988e1 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Tue, 30 Sep 2025 14:34:20 +0200 Subject: [PATCH 1/2] fix: Use the correct OCSController Signed-off-by: provokateurin --- .../lib/Controller/ConfigAPIController.php | 22 ++----------------- core/Controller/WhatsNewController.php | 12 ++-------- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/apps/user_ldap/lib/Controller/ConfigAPIController.php b/apps/user_ldap/lib/Controller/ConfigAPIController.php index d98e6d41b52..d78ee12f42b 100644 --- a/apps/user_ldap/lib/Controller/ConfigAPIController.php +++ b/apps/user_ldap/lib/Controller/ConfigAPIController.php @@ -6,9 +6,6 @@ */ namespace OCA\User_LDAP\Controller; -use OC\CapabilitiesManager; -use OC\Core\Controller\OCSController; -use OC\Security\IdentityProof\Manager; use OCA\User_LDAP\Configuration; use OCA\User_LDAP\ConnectionFactory; use OCA\User_LDAP\Helper; @@ -19,34 +16,19 @@ use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCS\OCSBadRequestException; use OCP\AppFramework\OCS\OCSException; use OCP\AppFramework\OCS\OCSNotFoundException; +use OCP\AppFramework\OCSController; use OCP\IRequest; -use OCP\IUserManager; -use OCP\IUserSession; -use OCP\ServerVersion; use Psr\Log\LoggerInterface; class ConfigAPIController extends OCSController { public function __construct( string $appName, IRequest $request, - CapabilitiesManager $capabilitiesManager, - IUserSession $userSession, - IUserManager $userManager, - Manager $keyManager, - ServerVersion $serverVersion, private Helper $ldapHelper, private LoggerInterface $logger, private ConnectionFactory $connectionFactory, ) { - parent::__construct( - $appName, - $request, - $capabilitiesManager, - $userSession, - $userManager, - $keyManager, - $serverVersion, - ); + parent::__construct($appName, $request); } /** diff --git a/core/Controller/WhatsNewController.php b/core/Controller/WhatsNewController.php index af8c3d4853b..7fa22b0faec 100644 --- a/core/Controller/WhatsNewController.php +++ b/core/Controller/WhatsNewController.php @@ -6,8 +6,6 @@ */ namespace OC\Core\Controller; -use OC\CapabilitiesManager; -use OC\Security\IdentityProof\Manager; use OC\Updater\ChangesCheck; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http; @@ -17,27 +15,21 @@ use OCP\AppFramework\Http\DataResponse; use OCP\Defaults; use OCP\IConfig; use OCP\IRequest; -use OCP\IUserManager; use OCP\IUserSession; use OCP\L10N\IFactory; use OCP\PreConditionNotMetException; -use OCP\ServerVersion; -class WhatsNewController extends OCSController { +class WhatsNewController extends \OCP\AppFramework\OCSController { public function __construct( string $appName, IRequest $request, - CapabilitiesManager $capabilitiesManager, private IUserSession $userSession, - IUserManager $userManager, - Manager $keyManager, - ServerVersion $serverVersion, private IConfig $config, private ChangesCheck $whatsNewService, private IFactory $langFactory, private Defaults $defaults, ) { - parent::__construct($appName, $request, $capabilitiesManager, $userSession, $userManager, $keyManager, $serverVersion); + parent::__construct($appName, $request); } /** From 28adf33e69153ad74e17b15e7abbd1a0eafa4fe0 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Tue, 30 Sep 2025 14:36:32 +0200 Subject: [PATCH 2/2] fix(core): Make OCSController class final to avoid accidentally extending it Signed-off-by: provokateurin --- core/Controller/OCSController.php | 6 +++++- core/openapi-administration.json | 4 ++++ core/openapi-ex_app.json | 4 ++++ core/openapi-full.json | 4 ++++ core/openapi.json | 4 ++++ openapi.json | 4 ++++ 6 files changed, 25 insertions(+), 1 deletion(-) diff --git a/core/Controller/OCSController.php b/core/Controller/OCSController.php index fb0280479c4..e1e220a6439 100644 --- a/core/Controller/OCSController.php +++ b/core/Controller/OCSController.php @@ -20,7 +20,11 @@ use OCP\IUserSession; use OCP\ServerVersion; use OCP\Util; -class OCSController extends \OCP\AppFramework\OCSController { +/** + * If you are here because you can't extend the OCSController class, you got the wrong one. + * Please use {@see \OCP\AppFramework\OCSController}! + */ +final class OCSController extends \OCP\AppFramework\OCSController { public function __construct( string $appName, IRequest $request, diff --git a/core/openapi-administration.json b/core/openapi-administration.json index 39e38822e89..f482f4992c1 100644 --- a/core/openapi-administration.json +++ b/core/openapi-administration.json @@ -644,6 +644,10 @@ } }, "tags": [ + { + "name": "ocs", + "description": "If you are here because you can't extend the OCSController class, you got the wrong one. Please use {@see \\OCP\\AppFramework\\OCSController}!" + }, { "name": "avatar", "description": "Class AvatarController" diff --git a/core/openapi-ex_app.json b/core/openapi-ex_app.json index 4df685320c2..2e346ca2316 100644 --- a/core/openapi-ex_app.json +++ b/core/openapi-ex_app.json @@ -1367,6 +1367,10 @@ } }, "tags": [ + { + "name": "ocs", + "description": "If you are here because you can't extend the OCSController class, you got the wrong one. Please use {@see \\OCP\\AppFramework\\OCSController}!" + }, { "name": "avatar", "description": "Class AvatarController" diff --git a/core/openapi-full.json b/core/openapi-full.json index 3da076db329..1cd58000816 100644 --- a/core/openapi-full.json +++ b/core/openapi-full.json @@ -11788,6 +11788,10 @@ } }, "tags": [ + { + "name": "ocs", + "description": "If you are here because you can't extend the OCSController class, you got the wrong one. Please use {@see \\OCP\\AppFramework\\OCSController}!" + }, { "name": "avatar", "description": "Class AvatarController" diff --git a/core/openapi.json b/core/openapi.json index 6d667a04e70..67b6e3fc6ce 100644 --- a/core/openapi.json +++ b/core/openapi.json @@ -10152,6 +10152,10 @@ } }, "tags": [ + { + "name": "ocs", + "description": "If you are here because you can't extend the OCSController class, you got the wrong one. Please use {@see \\OCP\\AppFramework\\OCSController}!" + }, { "name": "avatar", "description": "Class AvatarController" diff --git a/openapi.json b/openapi.json index 1a777cb7263..1577e283930 100644 --- a/openapi.json +++ b/openapi.json @@ -17,6 +17,10 @@ } ], "tags": [ + { + "name": "core/ocs", + "description": "If you are here because you can't extend the OCSController class, you got the wrong one. Please use {@see \\OCP\\AppFramework\\OCSController}!" + }, { "name": "core/avatar", "description": "Class AvatarController"