summaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api/lib/Controller/UsersController.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/provisioning_api/lib/Controller/UsersController.php')
-rw-r--r--apps/provisioning_api/lib/Controller/UsersController.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php
index 132727eecbd..25cc13d1c32 100644
--- a/apps/provisioning_api/lib/Controller/UsersController.php
+++ b/apps/provisioning_api/lib/Controller/UsersController.php
@@ -286,6 +286,7 @@ class UsersController extends OCSController {
$data[AccountManager::PROPERTY_WEBSITE] = $userAccount[AccountManager::PROPERTY_WEBSITE]['value'];
$data[AccountManager::PROPERTY_TWITTER] = $userAccount[AccountManager::PROPERTY_TWITTER]['value'];
$data['groups'] = $gids;
+ $data['language'] = $this->config->getUserValue($targetUserObject->getUID(), 'core', 'lang');
return $data;
}
@@ -322,6 +323,10 @@ class UsersController extends OCSController {
}
$permittedFields[] = 'password';
+ if ($this->config->getSystemValue('force_language', false) === false ||
+ $this->groupManager->isAdmin($currentLoggedInUser->getUID())) {
+ $permittedFields[] = 'language';
+ }
if ($this->appManager->isEnabledForUser('federatedfilesharing')) {
$federatedFileSharing = new \OCA\FederatedFileSharing\AppInfo\Application();
@@ -348,6 +353,7 @@ class UsersController extends OCSController {
$permittedFields[] = AccountManager::PROPERTY_DISPLAYNAME;
$permittedFields[] = AccountManager::PROPERTY_EMAIL;
$permittedFields[] = 'password';
+ $permittedFields[] = 'language';
$permittedFields[] = AccountManager::PROPERTY_PHONE;
$permittedFields[] = AccountManager::PROPERTY_ADDRESS;
$permittedFields[] = AccountManager::PROPERTY_WEBSITE;
@@ -392,6 +398,13 @@ class UsersController extends OCSController {
case 'password':
$targetUser->setPassword($value);
break;
+ case 'language':
+ $languagesCodes = $this->l10nFactory->findAvailableLanguages();
+ if (!in_array($value, $languagesCodes, true) && $value !== 'en') {
+ throw new OCSException('Invalid language', 102);
+ }
+ $this->config->setUserValue($targetUser->getUID(), 'core', 'lang', $value);
+ break;
case AccountManager::PROPERTY_EMAIL:
if(filter_var($value, FILTER_VALIDATE_EMAIL)) {
$targetUser->setEMailAddress($value);