diff options
author | Georg Ehrke <developer@georgehrke.com> | 2017-04-19 16:18:44 +0200 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2017-04-23 11:26:49 +0200 |
commit | c89e057d2765f0e594224ec24fcc424b75a01a87 (patch) | |
tree | 7deaf5216deb215f6ab8f3fc5df7a6ba176d8c1d /apps/dav/lib/CalDAV | |
parent | 11c795388848807590cb56befb28cafec17be3bd (diff) | |
download | nextcloud-server-c89e057d2765f0e594224ec24fcc424b75a01a87.tar.gz nextcloud-server-c89e057d2765f0e594224ec24fcc424b75a01a87.zip |
add owner-displayname property to calendars and addressbooks
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'apps/dav/lib/CalDAV')
-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']; + } + } } |