Skip to content

Commit 073aafb

Browse files
lfalsbackportbot-libresign[bot]
authored andcommitted
refactor(account-service): replace deprecated config APIs
Signed-off-by: Luis Amorim <luisfelipeamorim@hotmail.com>
1 parent 6dc3b2b commit 073aafb

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

lib/Service/AccountService.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use OCA\Libresign\Helper\FileUploadHelper;
2626
use OCA\Libresign\Helper\ValidateHelper;
2727
use OCA\Settings\Mailer\NewUserMailHelper;
28+
use OCP\Config\IUserConfig;
2829
use OCP\Accounts\IAccountManager;
2930
use OCP\AppFramework\Db\DoesNotExistException;
3031
use OCP\AppFramework\Utility\ITimeFactory;
@@ -35,7 +36,6 @@
3536
use OCP\Files\NotFoundException;
3637
use OCP\Http\Client\IClientService;
3738
use OCP\IAppConfig;
38-
use OCP\IConfig;
3939
use OCP\IGroupManager;
4040
use OCP\IL10N;
4141
use OCP\IURLGenerator;
@@ -61,8 +61,8 @@ public function __construct(
6161
private SignFileService $signFileService,
6262
private RequestSignatureService $requestSignatureService,
6363
private CertificateEngineFactory $certificateEngineFactory,
64-
private IConfig $config,
6564
private IAppConfig $appConfig,
65+
private IUserConfig $userConfig,
6666
private IMountProviderCollection $mountProviderCollection,
6767
private NewUserMailHelper $newUserMail,
6868
private IdentifyMethodService $identifyMethodService,
@@ -160,7 +160,7 @@ public function createToSign(string $uuid, string $email, string $password, ?str
160160

161161
$this->updateIdentifyMethodToAccount($signRequest->getId(), $email, $newUser->getUID());
162162

163-
if ($this->config->getAppValue('core', 'newUser.sendEmail', 'yes') === 'yes') {
163+
if ($this->appConfig->getValueString('core', 'newUser.sendEmail', 'yes') === 'yes') {
164164
try {
165165
$emailTemplate = $this->newUserMail->generateTemplate($newUser, false);
166166
$this->newUserMail->sendMail($newUser, $emailTemplate);
@@ -262,16 +262,15 @@ private function getUserConfigByKey(string $key, ?IUser $user = null): string {
262262
if (!$user) {
263263
return '';
264264
}
265-
266-
return $this->config->getUserValue($user->getUID(), Application::APP_ID, $key);
265+
return $this->userConfig->getValueString($user->getUID(), Application::APP_ID, $key);
267266
}
268267

269268
private function getUserConfigIdDocsFilters(?IUser $user = null): array {
270269
if (!$user) {
271270
return [];
272271
}
273272

274-
$value = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'id_docs_filters', '');
273+
$value = $this->userConfig->getValueString($user->getUID(), Application::APP_ID, 'id_docs_filters', '');
275274
if (empty($value)) {
276275
return [];
277276
}
@@ -285,7 +284,7 @@ private function getUserConfigCrlFilters(?IUser $user = null): array {
285284
return [];
286285
}
287286

288-
$value = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'crl_filters', '');
287+
$value = $this->userConfig->getValueString($user->getUID(), Application::APP_ID, 'crl_filters', '');
289288
if (empty($value)) {
290289
return [];
291290
}
@@ -299,7 +298,7 @@ private function getUserConfigCrlSort(?IUser $user): array {
299298
return ['sortBy' => 'revoked_at', 'sortOrder' => 'DESC'];
300299
}
301300

302-
$value = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'crl_sort', '');
301+
$value = $this->userConfig->getValueString($user->getUID(), Application::APP_ID, 'crl_sort', '');
303302
if (empty($value)) {
304303
return ['sortBy' => 'revoked_at', 'sortOrder' => 'DESC'];
305304
}
@@ -313,7 +312,7 @@ private function getUserConfigIdDocsSort(?IUser $user): array {
313312
return ['sortBy' => null, 'sortOrder' => null];
314313
}
315314

316-
$value = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'id_docs_sort', '');
315+
$value = $this->userConfig->getValueString($user->getUID(), Application::APP_ID, 'id_docs_sort', '');
317316
if (empty($value)) {
318317
return ['sortBy' => null, 'sortOrder' => null];
319318
}

0 commit comments

Comments
 (0)