-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose additional emails in {DAV:}alternate-URI-set
This allows iMip invitations to be send with an alternative email as "Reply-To" field. Closes #27201 Signed-off-by: Thomas Citharel <[email protected]>
- Loading branch information
Showing
9 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,10 @@ | |
use OCA\DAV\CalDAV\Proxy\Proxy; | ||
use OCA\DAV\CalDAV\Proxy\ProxyMapper; | ||
use OCA\DAV\Connector\Sabre\Principal; | ||
use OCP\Accounts\IAccount; | ||
use OCP\Accounts\IAccountManager; | ||
use OCP\Accounts\IAccountProperty; | ||
use OCP\Accounts\IAccountPropertyCollection; | ||
use OCP\App\IAppManager; | ||
use OCP\IConfig; | ||
use OCP\IGroup; | ||
|
@@ -59,6 +63,9 @@ class PrincipalTest extends TestCase { | |
/** @var IGroupManager | MockObject */ | ||
private $groupManager; | ||
|
||
/** @var IAccountManager|MockObject */ | ||
private $accountManager; | ||
|
||
/** @var IManager | MockObject */ | ||
private $shareManager; | ||
|
||
|
@@ -81,6 +88,7 @@ class PrincipalTest extends TestCase { | |
protected function setUp(): void { | ||
$this->userManager = $this->createMock(IUserManager::class); | ||
$this->groupManager = $this->createMock(IGroupManager::class); | ||
$this->accountManager = $this->createMock(IAccountManager::class); | ||
$this->shareManager = $this->createMock(IManager::class); | ||
$this->userSession = $this->createMock(IUserSession::class); | ||
$this->appManager = $this->createMock(IAppManager::class); | ||
|
@@ -92,6 +100,7 @@ protected function setUp(): void { | |
$this->connector = new Principal( | ||
$this->userManager, | ||
$this->groupManager, | ||
$this->accountManager, | ||
$this->shareManager, | ||
$this->userSession, | ||
$this->appManager, | ||
|
@@ -143,6 +152,45 @@ public function testGetPrincipalsByPrefixWithUsers(): void { | |
->withConsecutive([$fooUser], [$barUser]) | ||
->willReturnOnConsecutiveCalls('de', 'en'); | ||
|
||
$fooAccountPropertyCollection = $this->createMock(IAccountPropertyCollection::class); | ||
$fooAccountPropertyCollection->expects($this->once()) | ||
->method('getProperties') | ||
->with() | ||
->willReturn([]); | ||
$fooAccount = $this->createMock(IAccount::class); | ||
$fooAccount->expects($this->once()) | ||
->method('getPropertyCollection') | ||
->with(IAccountManager::COLLECTION_EMAIL) | ||
->willReturn($fooAccountPropertyCollection); | ||
|
||
$emailPropertyOne = $this->createMock(IAccountProperty::class); | ||
$emailPropertyOne->expects($this->once()) | ||
->method('getValue') | ||
->with() | ||
->willReturn('[email protected]'); | ||
$emailPropertyTwo = $this->createMock(IAccountProperty::class); | ||
$emailPropertyTwo->expects($this->once()) | ||
->method('getValue') | ||
->with() | ||
->willReturn('[email protected]'); | ||
|
||
$barAccountPropertyCollection = $this->createMock(IAccountPropertyCollection::class); | ||
$barAccountPropertyCollection->expects($this->once()) | ||
->method('getProperties') | ||
->with() | ||
->willReturn([$emailPropertyOne, $emailPropertyTwo]); | ||
$barAccount = $this->createMock(IAccount::class); | ||
$barAccount->expects($this->once()) | ||
->method('getPropertyCollection') | ||
->with(IAccountManager::COLLECTION_EMAIL) | ||
->willReturn($barAccountPropertyCollection); | ||
|
||
$this->accountManager | ||
->expects($this->exactly(2)) | ||
->method('getAccount') | ||
->withConsecutive([$fooUser], [$barUser]) | ||
->willReturnOnConsecutiveCalls($fooAccount, $barAccount); | ||
|
||
$expectedResponse = [ | ||
0 => [ | ||
'uri' => 'principals/users/foo', | ||
|
@@ -156,6 +204,7 @@ public function testGetPrincipalsByPrefixWithUsers(): void { | |
'{urn:ietf:params:xml:ns:caldav}calendar-user-type' => 'INDIVIDUAL', | ||
'{http://nextcloud.com/ns}language' => 'en', | ||
'{http://sabredav.org/ns}email-address' => '[email protected]', | ||
'{DAV:}alternate-URI-set' => ['mailto:[email protected]', 'mailto:[email protected]'] | ||
] | ||
]; | ||
$response = $this->connector->getPrincipalsByPrefix('principals/users'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters