aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Steinmetz <richard@steinmetz.cloud>2021-08-20 11:31:27 +0200
committerGitHub <noreply@github.com>2021-08-20 11:31:27 +0200
commit57ad9e4b0f972a8e51134bbe6bc486cefd33f5c3 (patch)
tree590b43dd81dc753d2343b6788e24bf1e8a6e2e6b
parentce97244231860f04d7a8dd4f9fbc2c66e7b8054b (diff)
parent2a78ea9dc6413e53805d9d2667b36f505f2a06ab (diff)
downloadnextcloud-server-57ad9e4b0f972a8e51134bbe6bc486cefd33f5c3.tar.gz
nextcloud-server-57ad9e4b0f972a8e51134bbe6bc486cefd33f5c3.zip
Merge pull request #28458 from nextcloud/expose-user-language-dav
Expose user language through DAV
-rw-r--r--apps/dav/appinfo/v1/caldav.php1
-rw-r--r--apps/dav/appinfo/v1/carddav.php1
-rw-r--r--apps/dav/lib/Command/CreateCalendar.php3
-rw-r--r--apps/dav/lib/Connector/Sabre/Principal.php6
-rw-r--r--apps/dav/lib/RootCollection.php3
-rw-r--r--apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php2
-rw-r--r--apps/dav/tests/unit/CardDAV/CardDavBackendTest.php2
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php143
-rw-r--r--apps/files_versions/lib/AppInfo/Application.php4
9 files changed, 105 insertions, 60 deletions
diff --git a/apps/dav/appinfo/v1/caldav.php b/apps/dav/appinfo/v1/caldav.php
index b1543ba3cef..28840fcef4c 100644
--- a/apps/dav/appinfo/v1/caldav.php
+++ b/apps/dav/appinfo/v1/caldav.php
@@ -52,6 +52,7 @@ $principalBackend = new Principal(
\OC::$server->query(\OCA\DAV\CalDAV\Proxy\ProxyMapper::class),
\OC::$server->get(KnownUserService::class),
\OC::$server->getConfig(),
+ \OC::$server->getL10NFactory(),
'principals/'
);
$db = \OC::$server->getDatabaseConnection();
diff --git a/apps/dav/appinfo/v1/carddav.php b/apps/dav/appinfo/v1/carddav.php
index 637ae3eed1a..53449b91c4b 100644
--- a/apps/dav/appinfo/v1/carddav.php
+++ b/apps/dav/appinfo/v1/carddav.php
@@ -55,6 +55,7 @@ $principalBackend = new Principal(
\OC::$server->query(\OCA\DAV\CalDAV\Proxy\ProxyMapper::class),
\OC::$server->get(KnownUserService::class),
\OC::$server->getConfig(),
+ \OC::$server->getL10NFactory(),
'principals/'
);
$db = \OC::$server->getDatabaseConnection();
diff --git a/apps/dav/lib/Command/CreateCalendar.php b/apps/dav/lib/Command/CreateCalendar.php
index 4d2012b0d39..1d818809245 100644
--- a/apps/dav/lib/Command/CreateCalendar.php
+++ b/apps/dav/lib/Command/CreateCalendar.php
@@ -87,7 +87,8 @@ class CreateCalendar extends Command {
\OC::$server->getAppManager(),
\OC::$server->query(ProxyMapper::class),
\OC::$server->get(KnownUserService::class),
- \OC::$server->getConfig()
+ \OC::$server->getConfig(),
+ \OC::$server->getL10NFactory(),
);
$random = \OC::$server->getSecureRandom();
$logger = \OC::$server->getLogger();
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();
diff --git a/apps/dav/lib/RootCollection.php b/apps/dav/lib/RootCollection.php
index aa81d2ff222..8d921414d51 100644
--- a/apps/dav/lib/RootCollection.php
+++ b/apps/dav/lib/RootCollection.php
@@ -73,7 +73,8 @@ class RootCollection extends SimpleCollection {
\OC::$server->getAppManager(),
$proxyMapper,
\OC::$server->get(KnownUserService::class),
- \OC::$server->getConfig()
+ \OC::$server->getConfig(),
+ \OC::$server->getL10NFactory()
);
$groupPrincipalBackend = new GroupPrincipalBackend($groupManager, $userSession, $shareManager, $config);
$calendarResourcePrincipalBackend = new ResourcePrincipalBackend($db, $userSession, $groupManager, $logger, $proxyMapper);
diff --git a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php
index 94e099f523e..c659e2ccc6d 100644
--- a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php
+++ b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php
@@ -37,6 +37,7 @@ use OCP\IGroupManager;
use OCP\ILogger;
use OCP\IUserManager;
use OCP\IUserSession;
+use OCP\L10N\IFactory;
use OCP\Security\ISecureRandom;
use OCP\Share\IManager as ShareManager;
use Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet;
@@ -94,6 +95,7 @@ abstract class AbstractCalDavBackend extends TestCase {
$this->createMock(ProxyMapper::class),
$this->createMock(KnownUserService::class),
$this->createMock(IConfig::class),
+ $this->createMock(IFactory::class)
])
->setMethods(['getPrincipalByPath', 'getGroupMembership'])
->getMock();
diff --git a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
index fb9522519a5..7eda691d199 100644
--- a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
+++ b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
@@ -46,6 +46,7 @@ use OCP\IGroupManager;
use OCP\IL10N;
use OCP\IUserManager;
use OCP\IUserSession;
+use OCP\L10N\IFactory;
use OCP\Share\IManager as ShareManager;
use Sabre\DAV\Exception\BadRequest;
use Sabre\DAV\PropPatch;
@@ -141,6 +142,7 @@ class CardDavBackendTest extends TestCase {
$this->createMock(ProxyMapper::class),
$this->createMock(KnownUserService::class),
$this->createMock(IConfig::class),
+ $this->createMock(IFactory::class)
])
->setMethods(['getPrincipalByPath', 'getGroupMembership'])
->getMock();
diff --git a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php
index acaa82dca8b..ba65edf2dd1 100644
--- a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php
@@ -33,6 +33,7 @@ use OC\KnownUser\KnownUserService;
use OC\User\User;
use OCA\DAV\CalDAV\Proxy\Proxy;
use OCA\DAV\CalDAV\Proxy\ProxyMapper;
+use OCA\DAV\Connector\Sabre\Principal;
use OCP\App\IAppManager;
use OCP\IConfig;
use OCP\IGroup;
@@ -40,38 +41,42 @@ use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserManager;
use OCP\IUserSession;
+use OCP\L10N\IFactory;
use OCP\Share\IManager;
use PHPUnit\Framework\MockObject\MockObject;
+use Sabre\DAV\Exception;
use Sabre\DAV\PropPatch;
use Test\TestCase;
class PrincipalTest extends TestCase {
- /** @var IUserManager | \PHPUnit\Framework\MockObject\MockObject */
+ /** @var IUserManager | MockObject */
private $userManager;
- /** @var \OCA\DAV\Connector\Sabre\Principal */
+ /** @var Principal */
private $connector;
- /** @var IGroupManager | \PHPUnit\Framework\MockObject\MockObject */
+ /** @var IGroupManager | MockObject */
private $groupManager;
- /** @var IManager | \PHPUnit\Framework\MockObject\MockObject */
+ /** @var IManager | MockObject */
private $shareManager;
- /** @var IUserSession | \PHPUnit\Framework\MockObject\MockObject */
+ /** @var IUserSession | MockObject */
private $userSession;
- /** @var IAppManager | \PHPUnit\Framework\MockObject\MockObject */
+ /** @var IAppManager | MockObject */
private $appManager;
- /** @var ProxyMapper | \PHPUnit\Framework\MockObject\MockObject */
+ /** @var ProxyMapper | MockObject */
private $proxyMapper;
/** @var KnownUserService|MockObject */
private $knownUserService;
- /** @var IConfig | \PHPUnit\Framework\MockObject\MockObject */
+ /** @var IConfig | MockObject */
private $config;
+ /** @var IFactory|MockObject */
+ private $languageFactory;
protected function setUp(): void {
$this->userManager = $this->createMock(IUserManager::class);
@@ -82,8 +87,9 @@ class PrincipalTest extends TestCase {
$this->proxyMapper = $this->createMock(ProxyMapper::class);
$this->knownUserService = $this->createMock(KnownUserService::class);
$this->config = $this->createMock(IConfig::class);
+ $this->languageFactory = $this->createMock(IFactory::class);
- $this->connector = new \OCA\DAV\Connector\Sabre\Principal(
+ $this->connector = new Principal(
$this->userManager,
$this->groupManager,
$this->shareManager,
@@ -91,37 +97,38 @@ class PrincipalTest extends TestCase {
$this->appManager,
$this->proxyMapper,
$this->knownUserService,
- $this->config
+ $this->config,
+ $this->languageFactory
);
parent::setUp();
}
- public function testGetPrincipalsByPrefixWithoutPrefix() {
+ public function testGetPrincipalsByPrefixWithoutPrefix(): void {
$response = $this->connector->getPrincipalsByPrefix('');
$this->assertSame([], $response);
}
- public function testGetPrincipalsByPrefixWithUsers() {
+ public function testGetPrincipalsByPrefixWithUsers(): void {
$fooUser = $this->createMock(User::class);
$fooUser
- ->expects($this->exactly(1))
+ ->expects($this->once())
->method('getUID')
->willReturn('foo');
$fooUser
- ->expects($this->exactly(1))
+ ->expects($this->once())
->method('getDisplayName')
->willReturn('Dr. Foo-Bar');
$fooUser
- ->expects($this->exactly(1))
+ ->expects($this->once())
->method('getEMailAddress')
->willReturn('');
$barUser = $this->createMock(User::class);
$barUser
- ->expects($this->exactly(1))
+ ->expects($this->once())
->method('getUID')
->willReturn('bar');
$barUser
- ->expects($this->exactly(1))
+ ->expects($this->once())
->method('getEMailAddress')
->willReturn('bar@nextcloud.com');
$this->userManager
@@ -130,16 +137,24 @@ class PrincipalTest extends TestCase {
->with('')
->willReturn([$fooUser, $barUser]);
+ $this->languageFactory
+ ->expects($this->exactly(2))
+ ->method('getUserLanguage')
+ ->withConsecutive([$fooUser], [$barUser])
+ ->willReturnOnConsecutiveCalls('de', 'en');
+
$expectedResponse = [
0 => [
'uri' => 'principals/users/foo',
'{DAV:}displayname' => 'Dr. Foo-Bar',
'{urn:ietf:params:xml:ns:caldav}calendar-user-type' => 'INDIVIDUAL',
+ '{http://nextcloud.com/ns}language' => 'de',
],
1 => [
'uri' => 'principals/users/bar',
'{DAV:}displayname' => 'bar',
'{urn:ietf:params:xml:ns:caldav}calendar-user-type' => 'INDIVIDUAL',
+ '{http://nextcloud.com/ns}language' => 'en',
'{http://sabredav.org/ns}email-address' => 'bar@nextcloud.com',
]
];
@@ -147,7 +162,7 @@ class PrincipalTest extends TestCase {
$this->assertSame($expectedResponse, $response);
}
- public function testGetPrincipalsByPrefixEmpty() {
+ public function testGetPrincipalsByPrefixEmpty(): void {
$this->userManager
->expects($this->once())
->method('search')
@@ -158,10 +173,10 @@ class PrincipalTest extends TestCase {
$this->assertSame([], $response);
}
- public function testGetPrincipalsByPathWithoutMail() {
+ public function testGetPrincipalsByPathWithoutMail(): void {
$fooUser = $this->createMock(User::class);
$fooUser
- ->expects($this->exactly(1))
+ ->expects($this->once())
->method('getUID')
->willReturn('foo');
$this->userManager
@@ -170,23 +185,30 @@ class PrincipalTest extends TestCase {
->with('foo')
->willReturn($fooUser);
+ $this->languageFactory
+ ->expects($this->once())
+ ->method('getUserLanguage')
+ ->with($fooUser)
+ ->willReturn('de');
+
$expectedResponse = [
'uri' => 'principals/users/foo',
'{DAV:}displayname' => 'foo',
'{urn:ietf:params:xml:ns:caldav}calendar-user-type' => 'INDIVIDUAL',
+ '{http://nextcloud.com/ns}language' => 'de'
];
$response = $this->connector->getPrincipalByPath('principals/users/foo');
$this->assertSame($expectedResponse, $response);
}
- public function testGetPrincipalsByPathWithMail() {
+ public function testGetPrincipalsByPathWithMail(): void {
$fooUser = $this->createMock(User::class);
$fooUser
- ->expects($this->exactly(1))
+ ->expects($this->once())
->method('getEMailAddress')
->willReturn('foo@nextcloud.com');
$fooUser
- ->expects($this->exactly(1))
+ ->expects($this->once())
->method('getUID')
->willReturn('foo');
$this->userManager
@@ -195,17 +217,24 @@ class PrincipalTest extends TestCase {
->with('foo')
->willReturn($fooUser);
+ $this->languageFactory
+ ->expects($this->once())
+ ->method('getUserLanguage')
+ ->with($fooUser)
+ ->willReturn('de');
+
$expectedResponse = [
'uri' => 'principals/users/foo',
'{DAV:}displayname' => 'foo',
'{urn:ietf:params:xml:ns:caldav}calendar-user-type' => 'INDIVIDUAL',
+ '{http://nextcloud.com/ns}language' => 'de',
'{http://sabredav.org/ns}email-address' => 'foo@nextcloud.com',
];
$response = $this->connector->getPrincipalByPath('principals/users/foo');
$this->assertSame($expectedResponse, $response);
}
- public function testGetPrincipalsByPathEmpty() {
+ public function testGetPrincipalsByPathEmpty(): void {
$this->userManager
->expects($this->once())
->method('get')
@@ -213,17 +242,17 @@ class PrincipalTest extends TestCase {
->willReturn(null);
$response = $this->connector->getPrincipalByPath('principals/users/foo');
- $this->assertSame(null, $response);
+ $this->assertNull($response);
}
- public function testGetGroupMemberSet() {
+ public function testGetGroupMemberSet(): void {
$response = $this->connector->getGroupMemberSet('principals/users/foo');
$this->assertSame([], $response);
}
- public function testGetGroupMemberSetEmpty() {
- $this->expectException(\Sabre\DAV\Exception::class);
+ public function testGetGroupMemberSetEmpty(): void {
+ $this->expectException(Exception::class);
$this->expectExceptionMessage('Principal not found');
$this->userManager
@@ -235,10 +264,10 @@ class PrincipalTest extends TestCase {
$this->connector->getGroupMemberSet('principals/users/foo/calendar-proxy-read');
}
- public function testGetGroupMemberSetProxyRead() {
+ public function testGetGroupMemberSetProxyRead(): void {
$fooUser = $this->createMock(User::class);
$fooUser
- ->expects($this->exactly(1))
+ ->expects($this->once())
->method('getUID')
->willReturn('foo');
$this->userManager
@@ -267,10 +296,10 @@ class PrincipalTest extends TestCase {
$this->assertEquals(['proxyId1'], $this->connector->getGroupMemberSet('principals/users/foo/calendar-proxy-read'));
}
- public function testGetGroupMemberSetProxyWrite() {
+ public function testGetGroupMemberSetProxyWrite(): void {
$fooUser = $this->createMock(User::class);
$fooUser
- ->expects($this->exactly(1))
+ ->expects($this->once())
->method('getUID')
->willReturn('foo');
$this->userManager
@@ -299,7 +328,7 @@ class PrincipalTest extends TestCase {
$this->assertEquals(['proxyId2', 'proxyId3'], $this->connector->getGroupMemberSet('principals/users/foo/calendar-proxy-write'));
}
- public function testGetGroupMembership() {
+ public function testGetGroupMembership(): void {
$fooUser = $this->createMock(User::class);
$group1 = $this->createMock(IGroup::class);
$group1->expects($this->once())
@@ -347,8 +376,8 @@ class PrincipalTest extends TestCase {
}
- public function testGetGroupMembershipEmpty() {
- $this->expectException(\Sabre\DAV\Exception::class);
+ public function testGetGroupMembershipEmpty(): void {
+ $this->expectException(Exception::class);
$this->expectExceptionMessage('Principal not found');
$this->userManager
@@ -361,22 +390,22 @@ class PrincipalTest extends TestCase {
}
- public function testSetGroupMembership() {
- $this->expectException(\Sabre\DAV\Exception::class);
+ public function testSetGroupMembership(): void {
+ $this->expectException(Exception::class);
$this->expectExceptionMessage('Setting members of the group is not supported yet');
$this->connector->setGroupMemberSet('principals/users/foo', ['foo']);
}
- public function testSetGroupMembershipProxy() {
+ public function testSetGroupMembershipProxy(): void {
$fooUser = $this->createMock(User::class);
$fooUser
- ->expects($this->exactly(1))
+ ->expects($this->once())
->method('getUID')
->willReturn('foo');
$barUser = $this->createMock(User::class);
$barUser
- ->expects($this->exactly(1))
+ ->expects($this->once())
->method('getUID')
->willReturn('bar');
$this->userManager
@@ -415,15 +444,15 @@ class PrincipalTest extends TestCase {
$this->connector->setGroupMemberSet('principals/users/foo/calendar-proxy-write', ['principals/users/bar']);
}
- public function testUpdatePrincipal() {
+ public function testUpdatePrincipal(): void {
$this->assertSame(0, $this->connector->updatePrincipal('foo', new PropPatch([])));
}
- public function testSearchPrincipalsWithEmptySearchProperties() {
+ public function testSearchPrincipalsWithEmptySearchProperties(): void {
$this->assertSame([], $this->connector->searchPrincipals('principals/users', []));
}
- public function testSearchPrincipalsWithWrongPrefixPath() {
+ public function testSearchPrincipalsWithWrongPrefixPath(): void {
$this->assertSame([], $this->connector->searchPrincipals('principals/groups',
['{http://sabredav.org/ns}email-address' => 'foo']));
}
@@ -431,7 +460,7 @@ class PrincipalTest extends TestCase {
/**
* @dataProvider searchPrincipalsDataProvider
*/
- public function testSearchPrincipals($sharingEnabled, $groupsOnly, $test, $result) {
+ public function testSearchPrincipals($sharingEnabled, $groupsOnly, $test, $result): void {
$this->shareManager->expects($this->once())
->method('shareAPIEnabled')
->willReturn($sharingEnabled);
@@ -515,7 +544,7 @@ class PrincipalTest extends TestCase {
'{DAV:}displayname' => 'User 12'], $test));
}
- public function searchPrincipalsDataProvider() {
+ public function searchPrincipalsDataProvider(): array {
return [
[true, false, 'allof', ['principals/users/user3']],
[true, false, 'anyof', ['principals/users/user2', 'principals/users/user3', 'principals/users/user4']],
@@ -526,7 +555,7 @@ class PrincipalTest extends TestCase {
];
}
- public function testSearchPrincipalByCalendarUserAddressSet() {
+ public function testSearchPrincipalByCalendarUserAddressSet(): void {
$this->shareManager->expects($this->exactly(2))
->method('shareAPIEnabled')
->willReturn(true);
@@ -556,7 +585,7 @@ class PrincipalTest extends TestCase {
['{urn:ietf:params:xml:ns:caldav}calendar-user-address-set' => 'user@example.com']));
}
- public function testSearchPrincipalWithEnumerationDisabledDisplayname() {
+ public function testSearchPrincipalWithEnumerationDisabledDisplayname(): void {
$this->shareManager->expects($this->once())
->method('shareAPIEnabled')
->willReturn(true);
@@ -595,7 +624,7 @@ class PrincipalTest extends TestCase {
['{DAV:}displayname' => 'User 2']));
}
- public function testSearchPrincipalWithEnumerationDisabledDisplaynameOnFullMatch() {
+ public function testSearchPrincipalWithEnumerationDisabledDisplaynameOnFullMatch(): void {
$this->shareManager->expects($this->once())
->method('shareAPIEnabled')
->willReturn(true);
@@ -616,7 +645,7 @@ class PrincipalTest extends TestCase {
['{DAV:}displayname' => 'User 2']));
}
- public function testSearchPrincipalWithEnumerationDisabledEmail() {
+ public function testSearchPrincipalWithEnumerationDisabledEmail(): void {
$this->shareManager->expects($this->once())
->method('shareAPIEnabled')
->willReturn(true);
@@ -655,7 +684,7 @@ class PrincipalTest extends TestCase {
['{http://sabredav.org/ns}email-address' => 'user2@foo.bar']));
}
- public function testSearchPrincipalWithEnumerationDisabledEmailOnFullMatch() {
+ public function testSearchPrincipalWithEnumerationDisabledEmailOnFullMatch(): void {
$this->shareManager->expects($this->once())
->method('shareAPIEnabled')
->willReturn(true);
@@ -677,7 +706,7 @@ class PrincipalTest extends TestCase {
['{http://sabredav.org/ns}email-address' => 'user2@foo.bar']));
}
- public function testSearchPrincipalWithEnumerationLimitedDisplayname() {
+ public function testSearchPrincipalWithEnumerationLimitedDisplayname(): void {
$this->shareManager->expects($this->at(0))
->method('shareAPIEnabled')
->willReturn(true);
@@ -738,7 +767,7 @@ class PrincipalTest extends TestCase {
['{DAV:}displayname' => 'User']));
}
- public function testSearchPrincipalWithEnumerationLimitedMail() {
+ public function testSearchPrincipalWithEnumerationLimitedMail(): void {
$this->shareManager->expects($this->at(0))
->method('shareAPIEnabled')
->willReturn(true);
@@ -799,7 +828,7 @@ class PrincipalTest extends TestCase {
['{http://sabredav.org/ns}email-address' => 'user']));
}
- public function testFindByUriSharingApiDisabled() {
+ public function testFindByUriSharingApiDisabled(): void {
$this->shareManager->expects($this->once())
->method('shareApiEnabled')
->willReturn(false);
@@ -810,7 +839,7 @@ class PrincipalTest extends TestCase {
/**
* @dataProvider findByUriWithGroupRestrictionDataProvider
*/
- public function testFindByUriWithGroupRestriction($uri, $email, $expects) {
+ public function testFindByUriWithGroupRestriction($uri, $email, $expects): void {
$this->shareManager->expects($this->once())
->method('shareApiEnabled')
->willReturn(true);
@@ -854,7 +883,7 @@ class PrincipalTest extends TestCase {
$this->assertEquals($expects, $this->connector->findByUri($uri, 'principals/users'));
}
- public function findByUriWithGroupRestrictionDataProvider() {
+ public function findByUriWithGroupRestrictionDataProvider(): array {
return [
['mailto:user2@foo.bar', 'user2@foo.bar', 'principals/users/user2'],
['mailto:user3@foo.bar', 'user3@foo.bar', null],
@@ -864,7 +893,7 @@ class PrincipalTest extends TestCase {
/**
* @dataProvider findByUriWithoutGroupRestrictionDataProvider
*/
- public function testFindByUriWithoutGroupRestriction($uri, $email, $expects) {
+ public function testFindByUriWithoutGroupRestriction($uri, $email, $expects): void {
$this->shareManager->expects($this->once())
->method('shareApiEnabled')
->willReturn(true);
@@ -886,7 +915,7 @@ class PrincipalTest extends TestCase {
$this->assertEquals($expects, $this->connector->findByUri($uri, 'principals/users'));
}
- public function findByUriWithoutGroupRestrictionDataProvider() {
+ public function findByUriWithoutGroupRestrictionDataProvider(): array {
return [
['mailto:user2@foo.bar', 'user2@foo.bar', 'principals/users/user2'],
['mailto:user3@foo.bar', 'user3@foo.bar', 'principals/users/user3'],
diff --git a/apps/files_versions/lib/AppInfo/Application.php b/apps/files_versions/lib/AppInfo/Application.php
index f0d182043c1..c994cd2f54a 100644
--- a/apps/files_versions/lib/AppInfo/Application.php
+++ b/apps/files_versions/lib/AppInfo/Application.php
@@ -48,6 +48,7 @@ use OCP\IGroupManager;
use OCP\IServerContainer;
use OCP\IUserManager;
use OCP\IUserSession;
+use OCP\L10N\IFactory;
use OCP\Share\IManager as IShareManager;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
@@ -79,7 +80,8 @@ class Application extends App implements IBootstrap {
$server->get(IAppManager::class),
$server->get(ProxyMapper::class),
$server->get(KnownUserService::class),
- $server->get(IConfig::class)
+ $server->get(IConfig::class),
+ $server->get(IFactory::class),
);
});