Browse Source

fix(user_ldap): Remove now unused class FilesystemHelper

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/50162/head
Côme Chilliet 11 months ago
parent
commit
12d1d1d389
No known key found for this signature in database GPG Key ID: A3E2F658B28C760A
  1. 1
      apps/user_ldap/composer/composer/autoload_classmap.php
  2. 1
      apps/user_ldap/composer/composer/autoload_static.php
  3. 2
      apps/user_ldap/lib/AppInfo/Application.php
  4. 32
      apps/user_ldap/lib/FilesystemHelper.php
  5. 4
      apps/user_ldap/lib/User/Manager.php
  6. 2
      apps/user_ldap/lib/User/User.php
  7. 2
      apps/user_ldap/tests/AccessTest.php
  8. 2
      apps/user_ldap/tests/Integration/AbstractIntegrationTest.php
  9. 2
      apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserAvatar.php
  10. 6
      apps/user_ldap/tests/User/ManagerTest.php
  11. 27
      apps/user_ldap/tests/User/UserTest.php

1
apps/user_ldap/composer/composer/autoload_classmap.php

@ -38,7 +38,6 @@ return array(
'OCA\\User_LDAP\\Exceptions\\ConstraintViolationException' => $baseDir . '/../lib/Exceptions/ConstraintViolationException.php',
'OCA\\User_LDAP\\Exceptions\\NoMoreResults' => $baseDir . '/../lib/Exceptions/NoMoreResults.php',
'OCA\\User_LDAP\\Exceptions\\NotOnLDAP' => $baseDir . '/../lib/Exceptions/NotOnLDAP.php',
'OCA\\User_LDAP\\FilesystemHelper' => $baseDir . '/../lib/FilesystemHelper.php',
'OCA\\User_LDAP\\GroupPluginManager' => $baseDir . '/../lib/GroupPluginManager.php',
'OCA\\User_LDAP\\Group_LDAP' => $baseDir . '/../lib/Group_LDAP.php',
'OCA\\User_LDAP\\Group_Proxy' => $baseDir . '/../lib/Group_Proxy.php',

1
apps/user_ldap/composer/composer/autoload_static.php

@ -53,7 +53,6 @@ class ComposerStaticInitUser_LDAP
'OCA\\User_LDAP\\Exceptions\\ConstraintViolationException' => __DIR__ . '/..' . '/../lib/Exceptions/ConstraintViolationException.php',
'OCA\\User_LDAP\\Exceptions\\NoMoreResults' => __DIR__ . '/..' . '/../lib/Exceptions/NoMoreResults.php',
'OCA\\User_LDAP\\Exceptions\\NotOnLDAP' => __DIR__ . '/..' . '/../lib/Exceptions/NotOnLDAP.php',
'OCA\\User_LDAP\\FilesystemHelper' => __DIR__ . '/..' . '/../lib/FilesystemHelper.php',
'OCA\\User_LDAP\\GroupPluginManager' => __DIR__ . '/..' . '/../lib/GroupPluginManager.php',
'OCA\\User_LDAP\\Group_LDAP' => __DIR__ . '/..' . '/../lib/Group_LDAP.php',
'OCA\\User_LDAP\\Group_Proxy' => __DIR__ . '/..' . '/../lib/Group_Proxy.php',

2
apps/user_ldap/lib/AppInfo/Application.php

@ -10,7 +10,6 @@ use OCA\Files_External\Service\BackendService;
use OCA\User_LDAP\Controller\RenewPasswordController;
use OCA\User_LDAP\Events\GroupBackendRegistered;
use OCA\User_LDAP\Events\UserBackendRegistered;
use OCA\User_LDAP\FilesystemHelper;
use OCA\User_LDAP\Group_Proxy;
use OCA\User_LDAP\GroupPluginManager;
use OCA\User_LDAP\Handler\ExtStorageConfigHandler;
@ -85,7 +84,6 @@ class Application extends App implements IBootstrap {
function (ContainerInterface $c) {
return new Manager(
$c->get(IConfig::class),
$c->get(FilesystemHelper::class),
$c->get(LoggerInterface::class),
$c->get(IAvatarManager::class),
$c->get(Image::class),

32
apps/user_ldap/lib/FilesystemHelper.php

@ -1,32 +0,0 @@
<?php
/**
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OCA\User_LDAP;
use OC\Files\Filesystem;
/**
* @brief wraps around static Nextcloud core methods
*/
class FilesystemHelper {
/**
* @brief states whether the filesystem was loaded
* @return bool
*/
public function isLoaded() {
return Filesystem::$loaded;
}
/**
* @brief initializes the filesystem for the given user
* @param string $uid the Nextcloud username of the user
*/
public function setup($uid) {
\OC_Util::setupFS($uid);
}
}

4
apps/user_ldap/lib/User/Manager.php

@ -8,7 +8,6 @@
namespace OCA\User_LDAP\User;
use OCA\User_LDAP\Access;
use OCA\User_LDAP\FilesystemHelper;
use OCP\Cache\CappedMemoryCache;
use OCP\IAvatarManager;
use OCP\IConfig;
@ -35,7 +34,6 @@ class Manager {
public function __construct(
protected IConfig $ocConfig,
protected FilesystemHelper $ocFilesystem,
protected LoggerInterface $logger,
protected IAvatarManager $avatarManager,
protected Image $image,
@ -66,7 +64,7 @@ class Manager {
private function createAndCache($dn, $uid) {
$this->checkAccess();
$user = new User($uid, $dn, $this->access, $this->ocConfig,
$this->ocFilesystem, clone $this->image, $this->logger,
clone $this->image, $this->logger,
$this->avatarManager, $this->userManager,
$this->notificationManager);
$this->usersByDN[$dn] = $user;

2
apps/user_ldap/lib/User/User.php

@ -12,7 +12,6 @@ use OC\Accounts\AccountManager;
use OCA\User_LDAP\Access;
use OCA\User_LDAP\Connection;
use OCA\User_LDAP\Exceptions\AttributeNotSet;
use OCA\User_LDAP\FilesystemHelper;
use OCA\User_LDAP\Service\BirthdateParserService;
use OCP\Accounts\IAccountManager;
use OCP\Accounts\PropertyDoesNotExistException;
@ -56,7 +55,6 @@ class User {
protected string $dn,
protected Access $access,
protected IConfig $config,
protected FilesystemHelper $fs,
protected Image $image,
protected LoggerInterface $logger,
protected IAvatarManager $avatarManager,

2
apps/user_ldap/tests/AccessTest.php

@ -10,7 +10,6 @@ use OC\ServerNotAvailableException;
use OCA\User_LDAP\Access;
use OCA\User_LDAP\Connection;
use OCA\User_LDAP\Exceptions\ConstraintViolationException;
use OCA\User_LDAP\FilesystemHelper;
use OCA\User_LDAP\Helper;
use OCA\User_LDAP\ILDAPWrapper;
use OCA\User_LDAP\LDAP;
@ -111,7 +110,6 @@ class AccessTest extends TestCase {
$um = $this->getMockBuilder(Manager::class)
->setConstructorArgs([
$this->createMock(IConfig::class),
$this->createMock(FilesystemHelper::class),
$this->createMock(LoggerInterface::class),
$this->createMock(IAvatarManager::class),
$this->createMock(Image::class),

2
apps/user_ldap/tests/Integration/AbstractIntegrationTest.php

@ -9,7 +9,6 @@ namespace OCA\User_LDAP\Tests\Integration;
use OCA\User_LDAP\Access;
use OCA\User_LDAP\Connection;
use OCA\User_LDAP\FilesystemHelper;
use OCA\User_LDAP\GroupPluginManager;
use OCA\User_LDAP\Helper;
use OCA\User_LDAP\LDAP;
@ -110,7 +109,6 @@ abstract class AbstractIntegrationTest {
protected function initUserManager() {
$this->userManager = new Manager(
\OC::$server->getConfig(),
new FilesystemHelper(),
\OC::$server->get(LoggerInterface::class),
\OC::$server->get(IAvatarManager::class),
new Image(),

2
apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserAvatar.php

@ -7,7 +7,6 @@
*/
namespace OCA\User_LDAP\Tests\Integration\Lib\User;
use OCA\User_LDAP\FilesystemHelper;
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest;
use OCA\User_LDAP\User\DeletedUsersIndex;
@ -115,7 +114,6 @@ class IntegrationTestUserAvatar extends AbstractIntegrationTest {
protected function initUserManager() {
$this->userManager = new Manager(
\OC::$server->getConfig(),
new FilesystemHelper(),
\OC::$server->get(LoggerInterface::class),
\OC::$server->get(IAvatarManager::class),
new Image(),

6
apps/user_ldap/tests/User/ManagerTest.php

@ -9,7 +9,6 @@ namespace OCA\User_LDAP\Tests\User;
use OCA\User_LDAP\Access;
use OCA\User_LDAP\Connection;
use OCA\User_LDAP\FilesystemHelper;
use OCA\User_LDAP\ILDAPWrapper;
use OCA\User_LDAP\User\Manager;
use OCA\User_LDAP\User\User;
@ -36,9 +35,6 @@ class ManagerTest extends \Test\TestCase {
/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
/** @var FilesystemHelper|\PHPUnit\Framework\MockObject\MockObject */
protected $fileSystemHelper;
/** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
protected $logger;
@ -73,7 +69,6 @@ class ManagerTest extends \Test\TestCase {
$this->access = $this->createMock(Access::class);
$this->config = $this->createMock(IConfig::class);
$this->fileSystemHelper = $this->createMock(FilesystemHelper::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->avatarManager = $this->createMock(IAvatarManager::class);
$this->image = $this->createMock(Image::class);
@ -91,7 +86,6 @@ class ManagerTest extends \Test\TestCase {
/** @noinspection PhpUnhandledExceptionInspection */
$this->manager = new Manager(
$this->config,
$this->fileSystemHelper,
$this->logger,
$this->avatarManager,
$this->image,

27
apps/user_ldap/tests/User/UserTest.php

@ -9,7 +9,6 @@ namespace OCA\User_LDAP\Tests\User;
use OCA\User_LDAP\Access;
use OCA\User_LDAP\Connection;
use OCA\User_LDAP\FilesystemHelper;
use OCA\User_LDAP\User\User;
use OCP\IAvatar;
use OCP\IAvatarManager;
@ -36,8 +35,6 @@ class UserTest extends \Test\TestCase {
protected $connection;
/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
/** @var FilesystemHelper|\PHPUnit\Framework\MockObject\MockObject */
protected $filesystemhelper;
/** @var INotificationManager|\PHPUnit\Framework\MockObject\MockObject */
protected $notificationManager;
/** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */
@ -67,7 +64,6 @@ class UserTest extends \Test\TestCase {
->willReturn($this->connection);
$this->config = $this->createMock(IConfig::class);
$this->filesystemhelper = $this->createMock(FilesystemHelper::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->avatarManager = $this->createMock(IAvatarManager::class);
$this->image = $this->createMock(Image::class);
@ -79,7 +75,6 @@ class UserTest extends \Test\TestCase {
$this->dn,
$this->access,
$this->config,
$this->filesystemhelper,
$this->image,
$this->logger,
$this->avatarManager,
@ -508,10 +503,6 @@ class UserTest extends \Test\TestCase {
->method('setUserValue')
->with($this->uid, 'user_ldap', 'lastAvatarChecksum', md5('this is a photo'));
$this->filesystemhelper->expects($this->once())
->method('isLoaded')
->willReturn(true);
$avatar = $this->createMock(IAvatar::class);
$avatar->expects($this->once())
->method('set')
@ -559,9 +550,6 @@ class UserTest extends \Test\TestCase {
$this->config->expects($this->never())
->method('setUserValue');
$this->filesystemhelper->expects($this->never())
->method('isLoaded');
$avatar = $this->createMock(IAvatar::class);
$avatar->expects($this->never())
->method('set');
@ -626,10 +614,6 @@ class UserTest extends \Test\TestCase {
->method('setUserValue')
->with($this->uid, 'user_ldap', 'lastAvatarChecksum', md5('this is a photo'));
$this->filesystemhelper->expects($this->once())
->method('isLoaded')
->willReturn(true);
$avatar = $this->createMock(IAvatar::class);
$avatar->expects($this->once())
->method('set')
@ -681,9 +665,6 @@ class UserTest extends \Test\TestCase {
$this->config->expects($this->never())
->method('setUserValue');
$this->filesystemhelper->expects($this->never())
->method('isLoaded');
$avatar = $this->createMock(IAvatar::class);
$avatar->expects($this->never())
->method('set');
@ -739,10 +720,6 @@ class UserTest extends \Test\TestCase {
$this->config->expects($this->never())
->method('setUserValue');
$this->filesystemhelper->expects($this->once())
->method('isLoaded')
->willReturn(true);
$avatar = $this->createMock(IAvatar::class);
$avatar->expects($this->once())
->method('set')
@ -792,9 +769,6 @@ class UserTest extends \Test\TestCase {
$this->config->expects($this->never())
->method('setUserValue');
$this->filesystemhelper->expects($this->never())
->method('isLoaded');
$this->avatarManager->expects($this->never())
->method('getAvatar');
@ -917,7 +891,6 @@ class UserTest extends \Test\TestCase {
$this->dn,
$this->access,
$this->config,
$this->filesystemhelper,
$this->image,
$this->logger,
$this->avatarManager,

Loading…
Cancel
Save