aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2017-06-08 09:08:24 +0200
committerGeorg Ehrke <developer@georgehrke.com>2017-06-12 21:01:30 +0200
commit35781ae45c517bb39cf3e43a5877226ab4c89bb6 (patch)
tree6eb19bf92ed5baa352b4e85312bcefe27e5594fa /apps/dav
parent0577e55559a9402b3c58e46d888b6780dbb6c68f (diff)
downloadnextcloud-server-35781ae45c517bb39cf3e43a5877226ab4c89bb6.tar.gz
nextcloud-server-35781ae45c517bb39cf3e43a5877226ab4c89bb6.zip
urldecode group principals in Cal- and CardDAV backend
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/CalDAV/CalDavBackend.php3
-rw-r--r--apps/dav/lib/CardDAV/CardDavBackend.php3
-rw-r--r--apps/dav/tests/unit/CalDAV/AbstractCalDavBackendTest.php3
-rw-r--r--apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php7
-rw-r--r--apps/dav/tests/unit/CardDAV/CardDavBackendTest.php4
5 files changed, 20 insertions, 0 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php
index ef3df8de83e..7fe18cd8656 100644
--- a/apps/dav/lib/CalDAV/CalDavBackend.php
+++ b/apps/dav/lib/CalDAV/CalDavBackend.php
@@ -276,6 +276,9 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
// 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);
diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php
index 983220c6ba0..5742f97b701 100644
--- a/apps/dav/lib/CardDAV/CardDavBackend.php
+++ b/apps/dav/lib/CardDAV/CardDavBackend.php
@@ -162,6 +162,9 @@ class CardDavBackend implements BackendInterface, SyncSupport {
// 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();
diff --git a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackendTest.php b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackendTest.php
index bc161b00d91..a7bf4432c64 100644
--- a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackendTest.php
+++ b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackendTest.php
@@ -91,6 +91,9 @@ abstract class AbstractCalDavBackendTest extends TestCase {
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))
diff --git a/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php b/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php
index 7c424fd0dd1..eb9f9cd10d7 100644
--- a/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php
+++ b/apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php
@@ -46,6 +46,10 @@ class PublicCalendarRootTest extends TestCase {
$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,
@@ -66,6 +70,9 @@ class PublicCalendarRootTest extends TestCase {
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']);
diff --git a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
index f3a271a2db2..8ca7e8a33b1 100644
--- a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
+++ b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
@@ -113,6 +113,10 @@ class CardDavBackendTest extends TestCase {
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']);