Skip to content

Commit

Permalink
allow sharing addressbooks with circles
Browse files Browse the repository at this point in the history
Signed-off-by: Georg Ehrke <[email protected]>
  • Loading branch information
georgehrke committed Mar 1, 2019
1 parent 5e37b52 commit 34601f8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 3 additions & 1 deletion apps/dav/lib/CardDAV/CardDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,10 @@ function getAddressBooksForUser($principalUri) {
}
$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);
Expand Down
3 changes: 1 addition & 2 deletions apps/dav/lib/Connector/Sabre/Principal.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,13 +426,12 @@ protected function circleToPrincipal($circleUniqueId) {
* @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) {
Expand Down

0 comments on commit 34601f8

Please sign in to comment.