Skip to content

Commit

Permalink
Override user language if enforced
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed May 4, 2020
1 parent 4e6a451 commit 6727d07
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/provisioning_api/lib/Controller/AUserData.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ protected function getUserData(string $userId): array {
throw new OCSNotFoundException($e->getMessage(), $e);
}

// Override language if enforced
$forceLanguage = $this->config->getSystemValue('force_language', false);

// Find the data
$data['id'] = $targetUserObject->getUID();
$data['lastLogin'] = $targetUserObject->getLastLogin() * 1000;
Expand All @@ -146,7 +149,7 @@ protected function getUserData(string $userId): array {
$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');
$data['language'] = $forceLanguage ?? $this->config->getUserValue($targetUserObject->getUID(), 'core', 'lang');
$data['locale'] = $this->config->getUserValue($targetUserObject->getUID(), 'core', 'locale');

$backend = $targetUserObject->getBackend();
Expand Down

0 comments on commit 6727d07

Please sign in to comment.