diff options
Diffstat (limited to 'apps/dav/lib/CalDAV/CalDavBackend.php')
-rw-r--r-- | apps/dav/lib/CalDAV/CalDavBackend.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 631593974e7..a4fed4f1982 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -248,6 +248,8 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $calendar[$xmlName] = $row[$dbName]; } + $this->addOwnerPrincipal($calendar); + if (!isset($calendars[$calendar['id']])) { $calendars[$calendar['id']] = $calendar; } @@ -319,6 +321,8 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $calendar[$xmlName] = $row[$dbName]; } + $this->addOwnerPrincipal($calendar); + $calendars[$calendar['id']] = $calendar; } $result->closeCursor(); @@ -359,6 +363,9 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription foreach($this->propertyMap as $xmlName=>$dbName) { $calendar[$xmlName] = $row[$dbName]; } + + $this->addOwnerPrincipal($calendar); + if (!isset($calendars[$calendar['id']])) { $calendars[$calendar['id']] = $calendar; } @@ -428,6 +435,8 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $calendar[$xmlName] = $row[$dbName]; } + $this->addOwnerPrincipal($calendar); + if (!isset($calendars[$calendar['id']])) { $calendars[$calendar['id']] = $calendar; } @@ -492,6 +501,8 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $calendar[$xmlName] = $row[$dbName]; } + $this->addOwnerPrincipal($calendar); + return $calendar; } @@ -543,6 +554,8 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $calendar[$xmlName] = $row[$dbName]; } + $this->addOwnerPrincipal($calendar); + return $calendar; } @@ -587,6 +600,8 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $calendar[$xmlName] = $row[$dbName]; } + $this->addOwnerPrincipal($calendar); + return $calendar; } @@ -1815,4 +1830,19 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription } return $principalUri; } + + private function addOwnerPrincipal(&$calendarInfo) { + $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; + $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; + if (isset($calendarInfo[$ownerPrincipalKey])) { + $uri = $calendarInfo[$ownerPrincipalKey]; + } else { + $uri = $calendarInfo['principaluri']; + } + + $principalInformation = $this->principalBackend->getPrincipalByPath($uri); + if (isset($principalInformation['{DAV:}displayname'])) { + $calendarInfo[$displaynameKey] = $principalInformation['{DAV:}displayname']; + } + } } |