diff --git a/apps/dav/lib/caldav/caldavbackend.php b/apps/dav/lib/caldav/caldavbackend.php index a188d652eed..3869d36886f 100644 --- a/apps/dav/lib/caldav/caldavbackend.php +++ b/apps/dav/lib/caldav/caldavbackend.php @@ -142,6 +142,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription * @return array */ function getCalendarsForUser($principalUri) { + $principalUriOriginal = $principalUri; $principalUri = $this->convertPrincipal($principalUri, true); $fields = array_values($this->propertyMap); $fields[] = 'id'; @@ -188,7 +189,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $stmt->closeCursor(); // query for shared calendars - $principals = $this->principalBackend->getGroupMembership($principalUri); + $principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true); $principals[]= $principalUri; $fields = array_values($this->propertyMap); diff --git a/apps/dav/lib/carddav/carddavbackend.php b/apps/dav/lib/carddav/carddavbackend.php index 89154c39d37..cabafd5c3ac 100644 --- a/apps/dav/lib/carddav/carddavbackend.php +++ b/apps/dav/lib/carddav/carddavbackend.php @@ -130,7 +130,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { $result->closeCursor(); // query for shared calendars - $principals = $this->principalBackend->getGroupMembership($principalUri); + $principals = $this->principalBackend->getGroupMembership($principalUri, true); $principals[]= $principalUri; $query = $this->db->getQueryBuilder(); diff --git a/apps/dav/lib/connector/sabre/principal.php b/apps/dav/lib/connector/sabre/principal.php index 31de4e5bad1..49fb4efdee2 100644 --- a/apps/dav/lib/connector/sabre/principal.php +++ b/apps/dav/lib/connector/sabre/principal.php @@ -135,7 +135,7 @@ class Principal implements BackendInterface { * @return array * @throws Exception */ - public function getGroupMembership($principal) { + public function getGroupMembership($principal, $needGroups = false) { list($prefix, $name) = URLUtil::splitPath($principal); if ($prefix === $this->principalPrefix) { @@ -144,7 +144,7 @@ class Principal implements BackendInterface { throw new Exception('Principal not found'); } - if ($this->hasGroups) { + if ($this->hasGroups || $needGroups) { $groups = $this->groupManager->getUserGroups($user); $groups = array_map(function($group) { /** @var IGroup $group */