|
12 | 12 |
|
13 | 13 | use InvalidArgumentException; |
14 | 14 | use OC\Authentication\Token\RemoteWipe; |
| 15 | +use OC\Core\AppInfo\ConfigLexicon; |
15 | 16 | use OC\Group\Group; |
16 | 17 | use OC\KnownUser\KnownUserService; |
17 | 18 | use OC\User\Backend; |
|
32 | 33 | use OCP\AppFramework\OCS\OCSForbiddenException; |
33 | 34 | use OCP\AppFramework\OCS\OCSNotFoundException; |
34 | 35 | use OCP\AppFramework\OCSController; |
| 36 | +use OCP\Config\IUserConfig; |
35 | 37 | use OCP\EventDispatcher\IEventDispatcher; |
36 | 38 | use OCP\Files\IRootFolder; |
37 | 39 | use OCP\Group\ISubAdmin; |
@@ -81,6 +83,7 @@ public function __construct( |
81 | 83 | private IEventDispatcher $eventDispatcher, |
82 | 84 | private IPhoneNumberUtil $phoneNumberUtil, |
83 | 85 | private IAppManager $appManager, |
| 86 | + private readonly IUserConfig $userConfig, |
84 | 87 | ) { |
85 | 88 | parent::__construct( |
86 | 89 | $appName, |
@@ -1116,19 +1119,19 @@ public function editUser(string $userId, string $key, string $value): DataRespon |
1116 | 1119 | if (!in_array($value, $languagesCodes, true) && $value !== 'en') { |
1117 | 1120 | throw new OCSException($this->l10n->t('Invalid language'), 101); |
1118 | 1121 | } |
1119 | | - $this->config->setUserValue($targetUser->getUID(), 'core', 'lang', $value); |
| 1122 | + $this->userConfig->setValueString($targetUser->getUID(), 'core', ConfigLexicon::USER_LANGUAGE, $value); |
1120 | 1123 | break; |
1121 | 1124 | case self::USER_FIELD_LOCALE: |
1122 | 1125 | if (!$this->l10nFactory->localeExists($value)) { |
1123 | 1126 | throw new OCSException($this->l10n->t('Invalid locale'), 101); |
1124 | 1127 | } |
1125 | | - $this->config->setUserValue($targetUser->getUID(), 'core', 'locale', $value); |
| 1128 | + $this->userConfig->setValueString($targetUser->getUID(), 'core', ConfigLexicon::USER_LOCALE, $value); |
1126 | 1129 | break; |
1127 | 1130 | case self::USER_FIELD_TIMEZONE: |
1128 | 1131 | if (!in_array($value, \DateTimeZone::listIdentifiers())) { |
1129 | 1132 | throw new OCSException($this->l10n->t('Invalid timezone'), 101); |
1130 | 1133 | } |
1131 | | - $this->config->setUserValue($targetUser->getUID(), 'core', 'timezone', $value); |
| 1134 | + $this->userConfig->setValueString($targetUser->getUID(), 'core', ConfigLexicon::USER_TIMEZONE, $value); |
1132 | 1135 | break; |
1133 | 1136 | case self::USER_FIELD_FIRST_DAY_OF_WEEK: |
1134 | 1137 | $intValue = (int)$value; |
|
0 commit comments