diff --git a/apps/files_external/lib/Command/Applicable.php b/apps/files_external/lib/Command/Applicable.php index dbedc72825cf5..6d917ae11b1aa 100644 --- a/apps/files_external/lib/Command/Applicable.php +++ b/apps/files_external/lib/Command/Applicable.php @@ -91,7 +91,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int return Response::HTTP_NOT_FOUND; } - if ($mount->getType() === StorageConfig::MOUNT_TYPE_PERSONAl) { + if ($mount->getType() === StorageConfig::MOUNT_TYPE_PERSONAL) { $output->writeln('Can\'t change applicables on personal mounts'); return self::FAILURE; } diff --git a/apps/files_external/lib/Config/ConfigAdapter.php b/apps/files_external/lib/Config/ConfigAdapter.php index c06df7765b63f..a60ee84820bad 100644 --- a/apps/files_external/lib/Config/ConfigAdapter.php +++ b/apps/files_external/lib/Config/ConfigAdapter.php @@ -140,7 +140,7 @@ public function getMountsForUser(IUser $user, IStorageFactory $loader) { }, $storages, $storageConfigs); $mounts = array_map(function (StorageConfig $storageConfig, Storage\IStorage $storage) use ($user, $loader) { - if ($storageConfig->getType() === StorageConfig::MOUNT_TYPE_PERSONAl) { + if ($storageConfig->getType() === StorageConfig::MOUNT_TYPE_PERSONAL) { return new PersonalMount( $this->userStoragesService, $storageConfig, diff --git a/apps/files_external/lib/Controller/StoragesController.php b/apps/files_external/lib/Controller/StoragesController.php index 229e2d1930e75..157ea0e7088bf 100644 --- a/apps/files_external/lib/Controller/StoragesController.php +++ b/apps/files_external/lib/Controller/StoragesController.php @@ -307,7 +307,7 @@ public function show($id, $testOnly = true) { $data = $storage->jsonSerialize(true); $isAdmin = $this->groupManager->isAdmin($this->userSession->getUser()->getUID()); - $data['can_edit'] = $storage->getType() === StorageConfig::MOUNT_TYPE_PERSONAl || $isAdmin; + $data['can_edit'] = $storage->getType() === StorageConfig::MOUNT_TYPE_PERSONAL || $isAdmin; return new DataResponse( $data, diff --git a/apps/files_external/lib/Controller/UserGlobalStoragesController.php b/apps/files_external/lib/Controller/UserGlobalStoragesController.php index 7b3f54d25c7eb..5ada021ccabbf 100644 --- a/apps/files_external/lib/Controller/UserGlobalStoragesController.php +++ b/apps/files_external/lib/Controller/UserGlobalStoragesController.php @@ -138,7 +138,7 @@ public function show($id, $testOnly = true) { $data = $storage->jsonSerialize(true); $isAdmin = $this->groupManager->isAdmin($this->userSession->getUser()->getUID()); - $data['can_edit'] = $storage->getType() === StorageConfig::MOUNT_TYPE_PERSONAl || $isAdmin; + $data['can_edit'] = $storage->getType() === StorageConfig::MOUNT_TYPE_PERSONAL || $isAdmin; return new DataResponse( $data, diff --git a/apps/files_external/lib/Lib/StorageConfig.php b/apps/files_external/lib/Lib/StorageConfig.php index 9e89e8fcc99bd..2d7d068763591 100644 --- a/apps/files_external/lib/Lib/StorageConfig.php +++ b/apps/files_external/lib/Lib/StorageConfig.php @@ -40,6 +40,8 @@ */ class StorageConfig implements \JsonSerializable { public const MOUNT_TYPE_ADMIN = 1; + public const MOUNT_TYPE_PERSONAL = 2; + /** @deprecated use MOUNT_TYPE_PERSONAL (full uppercase) instead */ public const MOUNT_TYPE_PERSONAl = 2; /** @@ -384,14 +386,14 @@ public function setStatus($status, $message = null) { } /** - * @return int self::MOUNT_TYPE_ADMIN or self::MOUNT_TYPE_PERSONAl + * @return int self::MOUNT_TYPE_ADMIN or self::MOUNT_TYPE_PERSONAL */ public function getType() { return $this->type; } /** - * @param int $type self::MOUNT_TYPE_ADMIN or self::MOUNT_TYPE_PERSONAl + * @param int $type self::MOUNT_TYPE_ADMIN or self::MOUNT_TYPE_PERSONAL */ public function setType($type) { $this->type = $type; @@ -435,7 +437,7 @@ public function jsonSerialize(bool $obfuscate = false): array { $result['statusMessage'] = $this->statusMessage; } $result['userProvided'] = $this->authMechanism instanceof IUserProvided; - $result['type'] = ($this->getType() === self::MOUNT_TYPE_PERSONAl) ? 'personal': 'system'; + $result['type'] = ($this->getType() === self::MOUNT_TYPE_PERSONAL) ? 'personal': 'system'; return $result; } diff --git a/apps/files_external/lib/Service/DBConfigService.php b/apps/files_external/lib/Service/DBConfigService.php index ca1d3a6696cb5..0488ddad5489f 100644 --- a/apps/files_external/lib/Service/DBConfigService.php +++ b/apps/files_external/lib/Service/DBConfigService.php @@ -37,6 +37,8 @@ */ class DBConfigService { public const MOUNT_TYPE_ADMIN = 1; + public const MOUNT_TYPE_PERSONAL = 2; + /** @deprecated use MOUNT_TYPE_PERSONAL (full uppercase) instead */ public const MOUNT_TYPE_PERSONAl = 2; public const APPLICABLE_TYPE_GLOBAL = 1; @@ -234,7 +236,7 @@ public function getAdminMountsForMultiple($type, array $values) { public function getUserMountsFor($type, $value) { $builder = $this->connection->getQueryBuilder(); $query = $this->getForQuery($builder, $type, $value); - $query->andWhere($builder->expr()->eq('m.type', $builder->expr()->literal(self::MOUNT_TYPE_PERSONAl, IQueryBuilder::PARAM_INT))); + $query->andWhere($builder->expr()->eq('m.type', $builder->expr()->literal(self::MOUNT_TYPE_PERSONAL, IQueryBuilder::PARAM_INT))); return $this->getMountsFromQuery($query); } diff --git a/apps/files_external/lib/Service/UserStoragesService.php b/apps/files_external/lib/Service/UserStoragesService.php index 47a6e919853ab..70004e7cdcc75 100644 --- a/apps/files_external/lib/Service/UserStoragesService.php +++ b/apps/files_external/lib/Service/UserStoragesService.php @@ -31,7 +31,6 @@ use OC\Files\Filesystem; use OCA\Files_External\Lib\StorageConfig; use OCA\Files_External\NotFoundException; - use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Config\IUserMountCache; use OCP\IUserSession; @@ -103,7 +102,7 @@ protected function triggerChangeHooks(StorageConfig $oldStorage, StorageConfig $ } protected function getType() { - return DBConfigService::MOUNT_TYPE_PERSONAl; + return DBConfigService::MOUNT_TYPE_PERSONAL; } /** @@ -144,7 +143,7 @@ public function getVisibilityType() { } protected function isApplicable(StorageConfig $config) { - return ($config->getApplicableUsers() === [$this->getUser()->getUID()]) && $config->getType() === StorageConfig::MOUNT_TYPE_PERSONAl; + return ($config->getApplicableUsers() === [$this->getUser()->getUID()]) && $config->getType() === StorageConfig::MOUNT_TYPE_PERSONAL; } public function removeStorage($id) { diff --git a/apps/files_external/tests/Auth/Password/GlobalAuth.php b/apps/files_external/tests/Auth/Password/GlobalAuth.php index 611efd3a8eb59..867e3329cb8bf 100644 --- a/apps/files_external/tests/Auth/Password/GlobalAuth.php +++ b/apps/files_external/tests/Auth/Password/GlobalAuth.php @@ -113,7 +113,7 @@ public function testNoCredentialsPersonal() { $this->credentialsManager->expects($this->never()) ->method('retrieve'); - $storage = $this->getStorageConfig(StorageConfig::MOUNT_TYPE_PERSONAl); + $storage = $this->getStorageConfig(StorageConfig::MOUNT_TYPE_PERSONAL); $this->instance->manipulateStorageConfig($storage); $this->assertEquals([], $storage->getBackendOptions()); diff --git a/apps/files_external/tests/Service/DBConfigServiceTest.php b/apps/files_external/tests/Service/DBConfigServiceTest.php index f5a93435a1dd7..2842bfd1b66e6 100644 --- a/apps/files_external/tests/Service/DBConfigServiceTest.php +++ b/apps/files_external/tests/Service/DBConfigServiceTest.php @@ -198,7 +198,7 @@ public function testGetMountsFor() { public function testGetAdminMounts() { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); - $this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAl); + $this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAL); $mounts = $this->dbConfig->getAdminMounts(); $this->assertCount(1, $mounts); @@ -208,7 +208,7 @@ public function testGetAdminMounts() { public function testGetAdminMountsFor() { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_ADMIN); - $id3 = $this->addMount('/test3', 'foo3', 'bar3', 100, DBConfigService::MOUNT_TYPE_PERSONAl); + $id3 = $this->addMount('/test3', 'foo3', 'bar3', 100, DBConfigService::MOUNT_TYPE_PERSONAL); $this->dbConfig->addApplicable($id1, DBConfigService::APPLICABLE_TYPE_USER, 'test'); $this->dbConfig->addApplicable($id3, DBConfigService::APPLICABLE_TYPE_USER, 'test'); @@ -221,8 +221,8 @@ public function testGetAdminMountsFor() { public function testGetUserMountsFor() { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); - $this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAl); - $id3 = $this->addMount('/test3', 'foo3', 'bar3', 100, DBConfigService::MOUNT_TYPE_PERSONAl); + $this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAL); + $id3 = $this->addMount('/test3', 'foo3', 'bar3', 100, DBConfigService::MOUNT_TYPE_PERSONAL); $this->dbConfig->addApplicable($id1, DBConfigService::APPLICABLE_TYPE_USER, 'test'); $this->dbConfig->addApplicable($id3, DBConfigService::APPLICABLE_TYPE_USER, 'test'); @@ -285,7 +285,7 @@ public function testGetMountsForDuplicateByGroup() { public function testGetAllMounts() { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); - $id2 = $this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAl); + $id2 = $this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAL); $mounts = $this->dbConfig->getAllMounts(); $this->assertCount(2, $mounts);