Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ function getCalendarsForUser($principalUri) {

// query for shared calendars
$principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true);
$principals = array_map(function($principal) {
return urldecode($principal);
}, $principals);
$principals[]= $principalUri;

$fields = array_values($this->propertyMap);
Expand Down
3 changes: 3 additions & 0 deletions apps/dav/lib/CardDAV/CardDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ function getAddressBooksForUser($principalUri) {

// query for shared calendars
$principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true);
$principals = array_map(function($principal) {
return urldecode($principal);
}, $principals);
$principals[]= $principalUri;

$query = $this->db->getQueryBuilder();
Expand Down
3 changes: 3 additions & 0 deletions apps/dav/tests/unit/CalDAV/AbstractCalDavBackendTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ public function cleanUpBackend() {
if (is_null($this->backend)) {
return;
}
$this->principal->expects($this->any())->method('getGroupMembership')
->withAnyParameters()
->willReturn([self::UNIT_TEST_GROUP, self::UNIT_TEST_GROUP2]);
$calendars = $this->backend->getCalendarsForUser(self::UNIT_TEST_USER);
foreach ($calendars as $calendar) {
$this->dispatcher->expects($this->at(0))
Expand Down
7 changes: 7 additions & 0 deletions apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public function setUp() {
$this->random = \OC::$server->getSecureRandom();
$dispatcher = $this->createMock(EventDispatcherInterface::class);

$this->principal->expects($this->any())->method('getGroupMembership')
->withAnyParameters()
->willReturn([]);

$this->backend = new CalDavBackend(
$db,
$this->principal,
Expand All @@ -66,6 +70,9 @@ public function tearDown() {
if (is_null($this->backend)) {
return;
}
$this->principal->expects($this->any())->method('getGroupMembership')
->withAnyParameters()
->willReturn([]);
$books = $this->backend->getCalendarsForUser(self::UNIT_TEST_USER);
foreach ($books as $book) {
$this->backend->deleteCalendar($book['id']);
Expand Down
4 changes: 4 additions & 0 deletions apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ public function tearDown() {
if (is_null($this->backend)) {
return;
}

$this->principal->method('getGroupMembership')
->withAnyParameters()
->willReturn([self::UNIT_TEST_GROUP]);
$books = $this->backend->getAddressBooksForUser(self::UNIT_TEST_USER);
foreach ($books as $book) {
$this->backend->deleteAddressBook($book['id']);
Expand Down