summaryrefslogtreecommitdiffstats
path: root/apps/dav
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2016-02-12 14:38:43 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-02-19 12:35:33 +0100
commit4e2f9ce05ba8b8a8d695fc85b5ef56b35e2d59cb (patch)
tree69995132a326cb242b8aa032e4dea1225c55ada5 /apps/dav
parentffc29503939ae34338108a50aaaba20e1ec1ad75 (diff)
downloadnextcloud-server-4e2f9ce05ba8b8a8d695fc85b5ef56b35e2d59cb.tar.gz
nextcloud-server-4e2f9ce05ba8b8a8d695fc85b5ef56b35e2d59cb.zip
Convert the old principal to the new principal before getting calendars
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/caldav/caldavbackend.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/apps/dav/lib/caldav/caldavbackend.php b/apps/dav/lib/caldav/caldavbackend.php
index c674876598d..7f6810fb1e2 100644
--- a/apps/dav/lib/caldav/caldavbackend.php
+++ b/apps/dav/lib/caldav/caldavbackend.php
@@ -138,6 +138,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
* @return array
*/
function getCalendarsForUser($principalUri) {
+ $principalUri = $this->convertPrincipal($principalUri, true);
$fields = array_values($this->propertyMap);
$fields[] = 'id';
$fields[] = 'uri';
@@ -164,7 +165,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$calendar = [
'id' => $row['id'],
'uri' => $row['uri'],
- 'principaluri' => $row['principaluri'],
+ 'principaluri' => $this->convertPrincipal($row['principaluri'], false),
'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
@@ -1093,7 +1094,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$newValues = [];
foreach($mutations as $propertyName=>$propertyValue) {
- if ($propertyName === '{http://calendarserver.org/ns/}source') {
+ if ($propertyName === '{http://calendarserver.org/ns/}source') {
$newValues['source'] = $propertyValue->getHref();
} else {
$fieldName = $this->subscriptionPropertyMap[$propertyName];
@@ -1373,4 +1374,14 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
return $this->sharingBackend->applyShareAcl($resourceId, $acl);
}
+ private function convertPrincipal($principalUri, $toV2) {
+ if ($this->principalBackend->getPrincipalPrefix() === 'principals') {
+ list(, $name) = URLUtil::splitPath($principalUri);
+ if ($toV2 === true) {
+ return "principals/users/$name";
+ }
+ return "principals/$name";
+ }
+ return $principalUri;
+ }
}