Merge pull request #60645 from nextcloud/backport/60641/stable32

[stable32] fix(caldav): grant sharee Acls to the delegate
This commit is contained in:
Christoph Wurst 2026-06-17 14:43:50 +02:00 committed by GitHub
commit be241c4db3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 42 additions and 0 deletions

View file

@ -173,18 +173,38 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable
'principal' => parent::getOwner(),
'protected' => true,
];
$acl[] = [
'privilege' => '{DAV:}read',
'principal' => parent::getOwner() . '/calendar-proxy-read',
'protected' => true,
];
$acl[] = [
'privilege' => '{DAV:}read',
'principal' => parent::getOwner() . '/calendar-proxy-write',
'protected' => true,
];
if ($this->canWrite()) {
$acl[] = [
'privilege' => '{DAV:}write',
'principal' => parent::getOwner(),
'protected' => true,
];
$acl[] = [
'privilege' => '{DAV:}write',
'principal' => parent::getOwner() . '/calendar-proxy-write',
'protected' => true,
];
} else {
$acl[] = [
'privilege' => '{DAV:}write-properties',
'principal' => parent::getOwner(),
'protected' => true,
];
$acl[] = [
'privilege' => '{DAV:}write-properties',
'principal' => parent::getOwner() . '/calendar-proxy-write',
'protected' => true,
];
}
}
if ($this->isPublic()) {
@ -201,6 +221,8 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable
$this->getOwner() . '/calendar-proxy-read',
$this->getOwner() . '/calendar-proxy-write',
parent::getOwner(),
parent::getOwner() . '/calendar-proxy-read',
parent::getOwner() . '/calendar-proxy-write',
'principals/system/public',
];
/** @var list<array{privilege: string, principal: string, protected: bool}> $acl */

View file

@ -236,18 +236,38 @@ class CalendarTest extends TestCase {
'principal' => 'user2',
'protected' => true
];
$expectedAcl[] = [
'privilege' => '{DAV:}read',
'principal' => 'user2/calendar-proxy-read',
'protected' => true
];
$expectedAcl[] = [
'privilege' => '{DAV:}read',
'principal' => 'user2/calendar-proxy-write',
'protected' => true
];
if ($expectsWrite) {
$expectedAcl[] = [
'privilege' => '{DAV:}write',
'principal' => 'user2',
'protected' => true
];
$expectedAcl[] = [
'privilege' => '{DAV:}write',
'principal' => 'user2/calendar-proxy-write',
'protected' => true
];
} else {
$expectedAcl[] = [
'privilege' => '{DAV:}write-properties',
'principal' => 'user2',
'protected' => true
];
$expectedAcl[] = [
'privilege' => '{DAV:}write-properties',
'principal' => 'user2/calendar-proxy-write',
'protected' => true
];
}
}
$this->assertEquals($expectedAcl, $acl);