allow sharing addressbooks with circles

Signed-off-by: Georg Ehrke <developer@georgehrke.com>
This commit is contained in:
Georg Ehrke 2019-03-01 13:02:30 +01:00
parent 5e37b52241
commit 34601f8623
No known key found for this signature in database
GPG Key ID: 9D98FD9380A1CB43
2 changed files with 4 additions and 3 deletions

View File

@ -167,8 +167,10 @@ class CardDavBackend implements BackendInterface, SyncSupport {
} }
$result->closeCursor(); $result->closeCursor();
// query for shared calendars // query for shared addressbooks
$principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true); $principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true);
$principals = array_merge($principals, $this->principalBackend->getCircleMembership($principalUriOriginal));
$principals = array_map(function($principal) { $principals = array_map(function($principal) {
return urldecode($principal); return urldecode($principal);
}, $principals); }, $principals);

View File

@ -426,13 +426,12 @@ class Principal implements BackendInterface {
* @return array * @return array
* @throws Exception * @throws Exception
*/ */
public function getCircleMembership($principal) { public function getCircleMembership($principal):array {
if (!\OC::$server->getAppManager()->isEnabledForUser('circles') || !class_exists('\OCA\Circles\ShareByCircleProvider')) { if (!\OC::$server->getAppManager()->isEnabledForUser('circles') || !class_exists('\OCA\Circles\ShareByCircleProvider')) {
return []; return [];
} }
list($prefix, $name) = \Sabre\Uri\split($principal); list($prefix, $name) = \Sabre\Uri\split($principal);
if ($this->hasCircles && $prefix === $this->principalPrefix) { if ($this->hasCircles && $prefix === $this->principalPrefix) {
$user = $this->userManager->get($name); $user = $this->userManager->get($name);
if (!$user) { if (!$user) {