Fix group shares on v1 caldav and carddav - fixes #23328
This commit is contained in:
parent
4b3af9dfe7
commit
4c738ea9c4
|
@ -138,6 +138,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getCalendarsForUser($principalUri) {
|
function getCalendarsForUser($principalUri) {
|
||||||
|
$principalUriOriginal = $principalUri;
|
||||||
$principalUri = $this->convertPrincipal($principalUri, true);
|
$principalUri = $this->convertPrincipal($principalUri, true);
|
||||||
$fields = array_values($this->propertyMap);
|
$fields = array_values($this->propertyMap);
|
||||||
$fields[] = 'id';
|
$fields[] = 'id';
|
||||||
|
@ -184,7 +185,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
// query for shared calendars
|
// query for shared calendars
|
||||||
$principals = $this->principalBackend->getGroupMembership($principalUri);
|
$principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true);
|
||||||
$principals[]= $principalUri;
|
$principals[]= $principalUri;
|
||||||
|
|
||||||
$fields = array_values($this->propertyMap);
|
$fields = array_values($this->propertyMap);
|
||||||
|
|
|
@ -126,7 +126,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
||||||
$result->closeCursor();
|
$result->closeCursor();
|
||||||
|
|
||||||
// query for shared calendars
|
// query for shared calendars
|
||||||
$principals = $this->principalBackend->getGroupMembership($principalUri);
|
$principals = $this->principalBackend->getGroupMembership($principalUri, true);
|
||||||
$principals[]= $principalUri;
|
$principals[]= $principalUri;
|
||||||
|
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
|
|
|
@ -135,7 +135,7 @@ class Principal implements BackendInterface {
|
||||||
* @return array
|
* @return array
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getGroupMembership($principal) {
|
public function getGroupMembership($principal, $needGroups = false) {
|
||||||
list($prefix, $name) = URLUtil::splitPath($principal);
|
list($prefix, $name) = URLUtil::splitPath($principal);
|
||||||
|
|
||||||
if ($prefix === $this->principalPrefix) {
|
if ($prefix === $this->principalPrefix) {
|
||||||
|
@ -144,7 +144,7 @@ class Principal implements BackendInterface {
|
||||||
throw new Exception('Principal not found');
|
throw new Exception('Principal not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->hasGroups) {
|
if ($this->hasGroups || $needGroups) {
|
||||||
$groups = $this->groupManager->getUserGroups($user);
|
$groups = $this->groupManager->getUserGroups($user);
|
||||||
$groups = array_map(function($group) {
|
$groups = array_map(function($group) {
|
||||||
/** @var IGroup $group */
|
/** @var IGroup $group */
|
||||||
|
|
Loading…
Reference in New Issue