Skip to content

Commit e48697f

Browse files
Merge pull request #60211 from nextcloud/fix/trashbin-proxy-acls
fix: add proper ACLs for trashbin proxys
2 parents 4902197 + 0d1349b commit e48697f

3 files changed

Lines changed: 50 additions & 3 deletions

File tree

apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObject.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,17 @@ public function getACL(): array {
105105
],
106106
[
107107
'privilege' => '{DAV:}unbind', // For moving and deletion
108-
'principal' => '{DAV:}owner',
108+
'principal' => $this->getOwner(),
109+
'protected' => true,
110+
],
111+
[
112+
'privilege' => '{DAV:}all',
113+
'principal' => $this->getOwner() . '/calendar-proxy-write',
114+
'protected' => true,
115+
],
116+
[
117+
'privilege' => '{DAV:}read',
118+
'principal' => $this->getOwner() . '/calendar-proxy-read',
109119
'protected' => true,
110120
],
111121
];

apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObjectsCollection.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,24 @@ public function getACL(): array {
137137
],
138138
[
139139
'privilege' => '{DAV:}unbind',
140-
'principal' => '{DAV:}owner',
140+
'principal' => $this->getOwner(),
141+
'protected' => true,
142+
],
143+
[
144+
'privilege' => '{DAV:}read',
145+
'principal' => $this->getOwner() . '/calendar-proxy-write',
146+
'protected' => true,
147+
],
148+
[
149+
'privilege' => '{DAV:}unbind',
150+
'principal' => $this->getOwner() . '/calendar-proxy-write',
141151
'protected' => true,
142-
]
152+
],
153+
[
154+
'privilege' => '{DAV:}read',
155+
'principal' => $this->getOwner() . '/calendar-proxy-read',
156+
'protected' => true,
157+
],
143158
];
144159
}
145160
}

apps/dav/lib/CalDAV/Trashbin/TrashbinHome.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,28 @@ public function getOwner(): string {
3737
return $this->principalInfo['uri'];
3838
}
3939

40+
#[\Override]
41+
public function getACL(): array {
42+
$ownerPrincipal = $this->principalInfo['uri'];
43+
return [
44+
[
45+
'privilege' => '{DAV:}all',
46+
'principal' => $ownerPrincipal,
47+
'protected' => true,
48+
],
49+
[
50+
'privilege' => '{DAV:}all',
51+
'principal' => $ownerPrincipal . '/calendar-proxy-write',
52+
'protected' => true,
53+
],
54+
[
55+
'privilege' => '{DAV:}read',
56+
'principal' => $ownerPrincipal . '/calendar-proxy-read',
57+
'protected' => true,
58+
],
59+
];
60+
}
61+
4062
#[\Override]
4163
public function createFile($name, $data = null) {
4264
throw new Forbidden('Permission denied to create files in the trashbin');

0 commit comments

Comments
 (0)