From 9a76d96d5da0ba54d9ee8bf2691200bfa8a3ff91 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Mon, 7 Sep 2026 17:38:30 -0100 Subject: [PATCH] cs:fix Signed-off-by: Maxence Lange --- appinfo/routes.php | 1 - lib/AppInfo/Application.php | 4 ---- lib/BackgroundJobs/UpdateLookupServer.php | 1 + lib/Command/GlobalScaleDiscovery.php | 1 + lib/Command/UsersUpdate.php | 2 -- lib/ConfigLexicon.php | 1 + lib/Controller/MasterController.php | 2 -- lib/Controller/SlaveController.php | 3 --- lib/GlobalSiteSelector.php | 4 ---- lib/Listeners/UserCreated.php | 1 - lib/Listeners/UserDeleted.php | 1 - lib/Lookup.php | 2 -- lib/Model/LocalFile.php | 1 + lib/Model/LocalMount.php | 1 + lib/Service/GlobalScaleService.php | 1 + lib/Service/GlobalShareService.php | 4 +--- lib/Service/SlaveService.php | 8 -------- lib/Slave.php | 2 -- lib/UserBackend.php | 6 ------ lib/UserDiscoveryModules/ManualUserMapping.php | 1 - lib/UserDiscoveryModules/UserDiscoveryOIDC.php | 1 - lib/UserDiscoveryModules/UserDiscoverySAML.php | 1 - tests/unit/lib/Controller/SlaveControllerTest.php | 1 - tests/unit/lib/GlobalSiteSelectorTest.php | 1 - tests/unit/lib/LookupTest.php | 1 - tests/unit/lib/MasterTest.php | 3 --- 26 files changed, 7 insertions(+), 48 deletions(-) diff --git a/appinfo/routes.php b/appinfo/routes.php index 6d1f187d..e05734b3 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -5,7 +5,6 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ - return [ 'ocs' => [ ['name' => 'Slave#createAppToken', 'url' => '/v1/createapptoken', 'verb' => 'GET'], diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 0d070206..d7721e63 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -64,7 +64,6 @@ public function __construct(array $urlParams = []) { parent::__construct(self::APP_ID, $urlParams); } - /** * @param IRegistrationContext $context */ @@ -103,7 +102,6 @@ function (GenericEvent $event) { ); } - /** * @param IBootContext $context * @@ -118,7 +116,6 @@ public function boot(IBootContext $context): void { $context->injectFn(Closure::fromCallable([$this, 'redirectToMasterLogin'])); } - /** * Register the Global Scale User Backend if we run in slave mode */ @@ -146,7 +143,6 @@ private function registerUserBackendForSlave() { $this->logger->debug('gss UserBackend registered', ['app' => self::APP_ID]); } - /** * Register the Global Scale User Backend if we run in slave mode */ diff --git a/lib/BackgroundJobs/UpdateLookupServer.php b/lib/BackgroundJobs/UpdateLookupServer.php index b7183d4d..cce82374 100644 --- a/lib/BackgroundJobs/UpdateLookupServer.php +++ b/lib/BackgroundJobs/UpdateLookupServer.php @@ -6,6 +6,7 @@ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\GlobalSiteSelector\BackgroundJobs; use OCA\GlobalSiteSelector\GlobalSiteSelector; diff --git a/lib/Command/GlobalScaleDiscovery.php b/lib/Command/GlobalScaleDiscovery.php index ff1fc583..abc0e277 100644 --- a/lib/Command/GlobalScaleDiscovery.php +++ b/lib/Command/GlobalScaleDiscovery.php @@ -6,6 +6,7 @@ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\GlobalSiteSelector\Command; use OC\Core\Command\Base; diff --git a/lib/Command/UsersUpdate.php b/lib/Command/UsersUpdate.php index 2d3c1ba2..07b806b2 100644 --- a/lib/Command/UsersUpdate.php +++ b/lib/Command/UsersUpdate.php @@ -23,7 +23,6 @@ public function __construct(Slave $slave) { $this->slave = $slave; } - /** * */ @@ -34,7 +33,6 @@ protected function configure() { ->setDescription('update known users data to Lookup Server'); } - /** * @param InputInterface $input * @param OutputInterface $output diff --git a/lib/ConfigLexicon.php b/lib/ConfigLexicon.php index a7d7dd50..32ed87ba 100644 --- a/lib/ConfigLexicon.php +++ b/lib/ConfigLexicon.php @@ -6,6 +6,7 @@ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\GlobalSiteSelector; use OCP\Config\Lexicon\Entry; diff --git a/lib/Controller/MasterController.php b/lib/Controller/MasterController.php index a48f5e7a..8c82c500 100644 --- a/lib/Controller/MasterController.php +++ b/lib/Controller/MasterController.php @@ -1,12 +1,10 @@ getMode() === self::SLAVE); } - /** * get JWT key * @@ -70,7 +68,6 @@ public function getJwtKey(): string { return $this->config->getSystemValueString('gss.jwt.key', ''); } - /** * get the URL of the global site selector master * @@ -86,7 +83,6 @@ public function getMasterUrl(): string { return $masterUrl; } - /** * get lookup server URL * diff --git a/lib/Listeners/UserCreated.php b/lib/Listeners/UserCreated.php index e535ba37..fddb1bec 100644 --- a/lib/Listeners/UserCreated.php +++ b/lib/Listeners/UserCreated.php @@ -26,7 +26,6 @@ public function __construct( ) { } - /** * @param Event $event */ diff --git a/lib/Listeners/UserDeleted.php b/lib/Listeners/UserDeleted.php index d5511045..6fffadf0 100644 --- a/lib/Listeners/UserDeleted.php +++ b/lib/Listeners/UserDeleted.php @@ -26,7 +26,6 @@ public function __construct( ) { } - /** * @param Event $event */ diff --git a/lib/Lookup.php b/lib/Lookup.php index 7ebd08f1..efd40bb1 100644 --- a/lib/Lookup.php +++ b/lib/Lookup.php @@ -105,7 +105,6 @@ public function getUserLocation(string $address, string &$uid = ''): string { } } - private function getUserLocation_Validate(string $address): string { try { $cloudId = $this->cloudIdManager->resolveCloudId($address); @@ -133,7 +132,6 @@ private function getUserLocation_Ignore(string $address, ?string &$uid = ''): st return rtrim($url, '/'); } - /** * based on the sanitizeUsername() method from apps/user_ldap/lib/Access.php * diff --git a/lib/Model/LocalFile.php b/lib/Model/LocalFile.php index 50846dad..5f1b36a8 100644 --- a/lib/Model/LocalFile.php +++ b/lib/Model/LocalFile.php @@ -6,6 +6,7 @@ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\GlobalSiteSelector\Model; use JsonSerializable; diff --git a/lib/Model/LocalMount.php b/lib/Model/LocalMount.php index 3f5fe263..e5ec2a87 100644 --- a/lib/Model/LocalMount.php +++ b/lib/Model/LocalMount.php @@ -6,6 +6,7 @@ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\GlobalSiteSelector\Model; use JsonSerializable; diff --git a/lib/Service/GlobalScaleService.php b/lib/Service/GlobalScaleService.php index 200b5a10..3f8ace52 100644 --- a/lib/Service/GlobalScaleService.php +++ b/lib/Service/GlobalScaleService.php @@ -6,6 +6,7 @@ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\GlobalSiteSelector\Service; use Exception; diff --git a/lib/Service/GlobalShareService.php b/lib/Service/GlobalShareService.php index 175b192d..28407320 100644 --- a/lib/Service/GlobalShareService.php +++ b/lib/Service/GlobalShareService.php @@ -6,6 +6,7 @@ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\GlobalSiteSelector\Service; use Exception; @@ -50,7 +51,6 @@ public function __construct( ) { } - /** * @return int|null NULL if file not fount */ @@ -98,7 +98,6 @@ public function getNewFileId(string $token, int $fileId): ?int { return $this->getSharedFileRemoteDetails($instance, $fileId); } - /** * @param string|null $instance set to NULL when assuming local * @return FederatedShare[] @@ -141,7 +140,6 @@ public function getSharedFiles(int $fileId, int $shareId = 0, ?string $instance return $this->shareRequest->getFederatedSharesRelatedToRemoteInstance($files, $instance); } - /** * get details about a shared remote file based on the address of the remote * instance and the id of the file as stored on that remote instance diff --git a/lib/Service/SlaveService.php b/lib/Service/SlaveService.php index 6707d213..3cfb702e 100644 --- a/lib/Service/SlaveService.php +++ b/lib/Service/SlaveService.php @@ -5,7 +5,6 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ - namespace OCA\GlobalSiteSelector\Service; use Exception; @@ -64,7 +63,6 @@ public function __construct( $this->cacheDisplayNameTtl = ($ttl === 0) ? self::CACHE_DISPLAY_NAME_TTL : $ttl; } - public function updateUserById(string $userId): void { $user = $this->userManager->get($userId); if (is_null($user)) { @@ -89,7 +87,6 @@ public function updateUser(IUser $user): void { $this->updateUsersOnLookup($userData); } - /** * get single user's display name * @@ -166,7 +163,6 @@ protected function getDetails(array $users, bool $cacheOnly = false): array { return array_merge($knownDetails, $details); } - protected function updateUsersOnLookup(array $users): void { $this->logger->debug( 'Batch updating users: {users}', @@ -176,7 +172,6 @@ protected function updateUsersOnLookup(array $users): void { $this->postLookup('/gs/users', ['users' => $users]); } - protected function postLookup(string $path, array $data): void { try { $this->checkConfiguration(); @@ -200,7 +195,6 @@ protected function postLookup(string $path, array $data): void { } } - /** * @param string $path * @param array $data @@ -231,7 +225,6 @@ protected function getLookup(string $path, array $data): string { return $response->getBody(); } - /** * @return void * @throws ConfigurationException @@ -250,7 +243,6 @@ protected function checkConfiguration(): void { } } - /** * get user data from account manager * diff --git a/lib/Slave.php b/lib/Slave.php index 09df9f2f..88558eaa 100644 --- a/lib/Slave.php +++ b/lib/Slave.php @@ -5,7 +5,6 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ - namespace OCA\GlobalSiteSelector; use Exception; @@ -34,7 +33,6 @@ class Slave { private IConfig $config; private static array $toRemove = []; // remember users which should be removed - public function __construct( IUserManager $userManager, IClientService $clientService, diff --git a/lib/UserBackend.php b/lib/UserBackend.php index b900a5ca..210a33f5 100644 --- a/lib/UserBackend.php +++ b/lib/UserBackend.php @@ -39,7 +39,6 @@ public function __construct( ) { } - /** * Backend name to be shown in user management * @@ -166,7 +165,6 @@ public function getUsers($search = '', $limit = null, $offset = null): array { return $uids; } - /** * counts the users in the database * @@ -313,7 +311,6 @@ public function isSessionActive(): bool { return ($this->getCurrentUserId() !== ''); } - /** * Return the id of the current user * @@ -332,7 +329,6 @@ public function getCurrentUserId(): string { return ''; } - /** * Check if the provided token is correct * @@ -387,7 +383,6 @@ public function registerBackends(array $backends): void { } } - public function updateAttributes(string $uid, array $attributes): void { $user = $this->userManager->get($uid); @@ -447,7 +442,6 @@ public function updateAttributes(string $uid, array $attributes): void { } } - /** * Whether $uid exists in the database * diff --git a/lib/UserDiscoveryModules/ManualUserMapping.php b/lib/UserDiscoveryModules/ManualUserMapping.php index af714183..c1da1055 100644 --- a/lib/UserDiscoveryModules/ManualUserMapping.php +++ b/lib/UserDiscoveryModules/ManualUserMapping.php @@ -46,7 +46,6 @@ public function __construct( $this->logger->debug('use regular expression: ' . ($this->useRegularExpressions ? 'true' : 'false')); } - /** * get the initial user location * diff --git a/lib/UserDiscoveryModules/UserDiscoveryOIDC.php b/lib/UserDiscoveryModules/UserDiscoveryOIDC.php index 6750189d..26570ebc 100644 --- a/lib/UserDiscoveryModules/UserDiscoveryOIDC.php +++ b/lib/UserDiscoveryModules/UserDiscoveryOIDC.php @@ -30,7 +30,6 @@ public function __construct(IConfig $config) { $this->tokenLocationAttribute = $config->getSystemValueString('gss.discovery.oidc.slave.mapping', ''); } - /** * read user location from OIDC token attribute * diff --git a/lib/UserDiscoveryModules/UserDiscoverySAML.php b/lib/UserDiscoveryModules/UserDiscoverySAML.php index 1000111c..3ed69ad3 100644 --- a/lib/UserDiscoveryModules/UserDiscoverySAML.php +++ b/lib/UserDiscoveryModules/UserDiscoverySAML.php @@ -29,7 +29,6 @@ public function __construct(IConfig $config) { $this->idpParameter = $config->getSystemValueString('gss.discovery.saml.slave.mapping', ''); } - /** * read user location from SAML parameters * diff --git a/tests/unit/lib/Controller/SlaveControllerTest.php b/tests/unit/lib/Controller/SlaveControllerTest.php index f314715a..61099dcf 100644 --- a/tests/unit/lib/Controller/SlaveControllerTest.php +++ b/tests/unit/lib/Controller/SlaveControllerTest.php @@ -5,7 +5,6 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ - namespace OCA\GlobalSiteSelector\Tests\Unit\Controller; use OC\Authentication\Token\IProvider; diff --git a/tests/unit/lib/GlobalSiteSelectorTest.php b/tests/unit/lib/GlobalSiteSelectorTest.php index d9516760..ee75f4ac 100644 --- a/tests/unit/lib/GlobalSiteSelectorTest.php +++ b/tests/unit/lib/GlobalSiteSelectorTest.php @@ -5,7 +5,6 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ - namespace OCA\GlobalSiteSelector\Tests\Unit; use OCA\GlobalSiteSelector\GlobalSiteSelector; diff --git a/tests/unit/lib/LookupTest.php b/tests/unit/lib/LookupTest.php index b8b16818..6ed7eec7 100644 --- a/tests/unit/lib/LookupTest.php +++ b/tests/unit/lib/LookupTest.php @@ -5,7 +5,6 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ - namespace OCA\GlobalSiteSelector\Tests\Unit; use OCA\GlobalSiteSelector\GlobalSiteSelector; diff --git a/tests/unit/lib/MasterTest.php b/tests/unit/lib/MasterTest.php index bef4d487..f1a6ed9c 100644 --- a/tests/unit/lib/MasterTest.php +++ b/tests/unit/lib/MasterTest.php @@ -5,7 +5,6 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ - namespace OCA\GlobalSiteSelector\Tests\Unit; use OC\Core\Service\LoginFlowV2Service; @@ -106,7 +105,6 @@ public function testHandleLoginRequestException() { $master->handleLoginRequest('user', 'password'); } - public function testCreateJWT() { $uid = 'user1'; $plainPassword = 'password'; @@ -169,7 +167,6 @@ public function dataTestNormalizeLocation() { ['localhost/nextcloud', 'https://localhost/nextcloud'], ['https://localhost/nextcloud', 'https://localhost/nextcloud'], ['http://localhost/nextcloud', 'http://localhost/nextcloud'], - ]; } }