From 34601f86232621916ebb044dc08d706bd997bbd2 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 1 Mar 2019 13:02:30 +0100 Subject: [PATCH] allow sharing addressbooks with circles Signed-off-by: Georg Ehrke --- apps/dav/lib/CardDAV/CardDavBackend.php | 4 +++- apps/dav/lib/Connector/Sabre/Principal.php | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php index 699248f7b1..f30a12bba4 100644 --- a/apps/dav/lib/CardDAV/CardDavBackend.php +++ b/apps/dav/lib/CardDAV/CardDavBackend.php @@ -167,8 +167,10 @@ class CardDavBackend implements BackendInterface, SyncSupport { } $result->closeCursor(); - // query for shared calendars + // query for shared addressbooks $principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true); + $principals = array_merge($principals, $this->principalBackend->getCircleMembership($principalUriOriginal)); + $principals = array_map(function($principal) { return urldecode($principal); }, $principals); diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php index 39b4da683a..18c5545d8d 100644 --- a/apps/dav/lib/Connector/Sabre/Principal.php +++ b/apps/dav/lib/Connector/Sabre/Principal.php @@ -426,13 +426,12 @@ class Principal implements BackendInterface { * @return array * @throws Exception */ - public function getCircleMembership($principal) { + public function getCircleMembership($principal):array { if (!\OC::$server->getAppManager()->isEnabledForUser('circles') || !class_exists('\OCA\Circles\ShareByCircleProvider')) { return []; } list($prefix, $name) = \Sabre\Uri\split($principal); - if ($this->hasCircles && $prefix === $this->principalPrefix) { $user = $this->userManager->get($name); if (!$user) {