diff options
author | Thomas Citharel <tcit@tcit.fr> | 2021-08-16 18:55:27 +0300 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2021-08-16 20:03:00 +0300 |
commit | a7b9b398a35c914b39c8eb41f920612a5f21eb36 (patch) | |
tree | 696a300f8e7a33827653628464b15b0506f02035 /apps/dav/lib/Connector/Sabre | |
parent | 5da42273805160f75436f53b829b17e7b4ed2054 (diff) |
Expose user language through DAV
Introduces the '{http://nextcloud.com/ns}language' prop that gives the
user's language
Closes #28449
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Diffstat (limited to 'apps/dav/lib/Connector/Sabre')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/Principal.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php index 5e81e155d74..4a422fa9628 100644 --- a/apps/dav/lib/Connector/Sabre/Principal.php +++ b/apps/dav/lib/Connector/Sabre/Principal.php @@ -50,6 +50,7 @@ use OCP\IGroupManager; use OCP\IUser; use OCP\IUserManager; use OCP\IUserSession; +use OCP\L10N\IFactory; use OCP\Share\IManager as IShareManager; use Sabre\DAV\Exception; use Sabre\DAV\PropPatch; @@ -89,6 +90,8 @@ class Principal implements BackendInterface { /** @var IConfig */ private $config; + /** @var IFactory */ + private $languageFactory; public function __construct(IUserManager $userManager, IGroupManager $groupManager, @@ -98,6 +101,7 @@ class Principal implements BackendInterface { ProxyMapper $proxyMapper, KnownUserService $knownUserService, IConfig $config, + IFactory $languageFactory, string $principalPrefix = 'principals/users/') { $this->userManager = $userManager; $this->groupManager = $groupManager; @@ -109,6 +113,7 @@ class Principal implements BackendInterface { $this->proxyMapper = $proxyMapper; $this->knownUserService = $knownUserService; $this->config = $config; + $this->languageFactory = $languageFactory; } use PrincipalProxyTrait { @@ -508,6 +513,7 @@ class Principal implements BackendInterface { 'uri' => $this->principalPrefix . '/' . $userId, '{DAV:}displayname' => is_null($displayName) ? $userId : $displayName, '{urn:ietf:params:xml:ns:caldav}calendar-user-type' => 'INDIVIDUAL', + '{http://nextcloud.com/ns}language' => $this->languageFactory->getUserLanguage($user), ]; $email = $user->getEMailAddress(); |