From ad0a11b2bf7fd779d609a99714bdb396c1605740 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Wed, 30 Jun 2021 00:38:28 +0200 Subject: [PATCH] cleanup Signed-off-by: Arthur Schiwon --- .../lib/Controller/UsersController.php | 6 ------ .../tests/Controller/UsersControllerTest.php | 8 -------- lib/private/Accounts/AccountManager.php | 10 +++------- 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php index b81801aba28..d94e8fed8a8 100644 --- a/apps/provisioning_api/lib/Controller/UsersController.php +++ b/apps/provisioning_api/lib/Controller/UsersController.php @@ -54,7 +54,6 @@ use OCA\Settings\Mailer\NewUserMailHelper; use OCP\Accounts\IAccountManager; use OCP\Accounts\IAccountProperty; use OCP\Accounts\PropertyDoesNotExistException; -use OCP\App\IAppManager; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCS\OCSException; @@ -77,8 +76,6 @@ use Psr\Log\LoggerInterface; class UsersController extends AUserData { - /** @var IAppManager */ - private $appManager; /** @var IURLGenerator */ protected $urlGenerator; /** @var LoggerInterface */ @@ -100,7 +97,6 @@ class UsersController extends AUserData { IRequest $request, IUserManager $userManager, IConfig $config, - IAppManager $appManager, IGroupManager $groupManager, IUserSession $userSession, IAccountManager $accountManager, @@ -121,7 +117,6 @@ class UsersController extends AUserData { $accountManager, $l10nFactory); - $this->appManager = $appManager; $this->urlGenerator = $urlGenerator; $this->logger = $logger; $this->l10nFactory = $l10nFactory; @@ -656,7 +651,6 @@ class UsersController extends AUserData { $mailCollection = $userAccount->getPropertyCollection(IAccountManager::COLLECTION_EMAIL); $mailCollection->removePropertyByValue($key); if ($value !== '') { - // "replace on" $mailCollection->addPropertyWithDefaults($value); } $this->accountManager->updateAccount($userAccount); diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php index 6dc0969d103..238bac34307 100644 --- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php +++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php @@ -50,7 +50,6 @@ use OCA\Settings\Mailer\NewUserMailHelper; use OCP\Accounts\IAccount; use OCP\Accounts\IAccountManager; use OCP\Accounts\IAccountProperty; -use OCP\App\IAppManager; use OCP\AppFramework\Http\DataResponse; use OCP\EventDispatcher\IEventDispatcher; use OCP\IConfig; @@ -77,8 +76,6 @@ class UsersControllerTest extends TestCase { protected $userManager; /** @var IConfig|MockObject */ protected $config; - /** @var IAppManager|MockObject */ - protected $appManager; /** @var Manager|MockObject */ protected $groupManager; /** @var IUserSession|MockObject */ @@ -111,7 +108,6 @@ class UsersControllerTest extends TestCase { $this->userManager = $this->createMock(IUserManager::class); $this->config = $this->createMock(IConfig::class); - $this->appManager = $this->createMock(IAppManager::class); $this->groupManager = $this->createMock(Manager::class); $this->userSession = $this->createMock(IUserSession::class); $this->logger = $this->createMock(LoggerInterface::class); @@ -131,7 +127,6 @@ class UsersControllerTest extends TestCase { $this->request, $this->userManager, $this->config, - $this->appManager, $this->groupManager, $this->userSession, $this->accountManager, @@ -395,7 +390,6 @@ class UsersControllerTest extends TestCase { $this->request, $this->userManager, $this->config, - $this->appManager, $this->groupManager, $this->userSession, $this->accountManager, @@ -3440,7 +3434,6 @@ class UsersControllerTest extends TestCase { $this->request, $this->userManager, $this->config, - $this->appManager, $this->groupManager, $this->userSession, $this->accountManager, @@ -3513,7 +3506,6 @@ class UsersControllerTest extends TestCase { $this->request, $this->userManager, $this->config, - $this->appManager, $this->groupManager, $this->userSession, $this->accountManager, diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php index b042309dd3a..9fc5accfa08 100644 --- a/lib/private/Accounts/AccountManager.php +++ b/lib/private/Accounts/AccountManager.php @@ -228,7 +228,6 @@ class AccountManager implements IAccountManager { $updated = true; if ($oldUserData !== $data) { - $this->updateExistingUser($user, $data); } else { // nothing needs to be done if new and old data set are the same @@ -297,7 +296,6 @@ class AccountManager implements IAccountManager { $userDataArray = $this->importFromJson($accountData[0]['data'], $uid); if ($userDataArray === null || $userDataArray === []) { - return $this->buildDefaultUserRecord($user); } @@ -339,7 +337,7 @@ class AccountManager implements IAccountManager { /** * check if we need to ask the server for email verification, if yes we create a cronjob - + * */ protected function checkEmailVerification(IAccount $updatedAccount, array $oldData): void { try { @@ -369,14 +367,13 @@ class AccountManager implements IAccountManager { /** * make sure that all expected data are set - + * */ protected function addMissingDefaultValues(array $userData): array { foreach ($userData as $i => $value) { if (!isset($value['verified'])) { $userData[$i]['verified'] = self::NOT_VERIFIED; } - } return $userData; @@ -612,7 +609,6 @@ class AccountManager implements IAccountManager { } public function updateAccount(IAccount $account): void { - $this->testValueLengths(iterator_to_array($account->getAllProperties()), true); try { $property = $account->getProperty(self::PROPERTY_PHONE); @@ -657,4 +653,4 @@ class AccountManager implements IAccountManager { $this->updateUser($account->getUser(), $data, true); } -} \ No newline at end of file +} -- 2.39.5