File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9696 'OCA \\DAV \\CalDAV \\Outbox ' => $ baseDir . '/../lib/CalDAV/Outbox.php ' ,
9797 'OCA \\DAV \\CalDAV \\Plugin ' => $ baseDir . '/../lib/CalDAV/Plugin.php ' ,
9898 'OCA \\DAV \\CalDAV \\Principal \\Collection ' => $ baseDir . '/../lib/CalDAV/Principal/Collection.php ' ,
99+ 'OCA \\DAV \\CalDAV \\Principal \\ProxyRead ' => $ baseDir . '/../lib/CalDAV/Principal/ProxyRead.php ' ,
100+ 'OCA \\DAV \\CalDAV \\Principal \\ProxyWrite ' => $ baseDir . '/../lib/CalDAV/Principal/ProxyWrite.php ' ,
99101 'OCA \\DAV \\CalDAV \\Principal \\User ' => $ baseDir . '/../lib/CalDAV/Principal/User.php ' ,
100102 'OCA \\DAV \\CalDAV \\Proxy \\Proxy ' => $ baseDir . '/../lib/CalDAV/Proxy/Proxy.php ' ,
101103 'OCA \\DAV \\CalDAV \\Proxy \\ProxyMapper ' => $ baseDir . '/../lib/CalDAV/Proxy/ProxyMapper.php ' ,
Original file line number Diff line number Diff line change @@ -111,6 +111,8 @@ class ComposerStaticInitDAV
111111 'OCA \\DAV \\CalDAV \\Outbox ' => __DIR__ . '/.. ' . '/../lib/CalDAV/Outbox.php ' ,
112112 'OCA \\DAV \\CalDAV \\Plugin ' => __DIR__ . '/.. ' . '/../lib/CalDAV/Plugin.php ' ,
113113 'OCA \\DAV \\CalDAV \\Principal \\Collection ' => __DIR__ . '/.. ' . '/../lib/CalDAV/Principal/Collection.php ' ,
114+ 'OCA \\DAV \\CalDAV \\Principal \\ProxyRead ' => __DIR__ . '/.. ' . '/../lib/CalDAV/Principal/ProxyRead.php ' ,
115+ 'OCA \\DAV \\CalDAV \\Principal \\ProxyWrite ' => __DIR__ . '/.. ' . '/../lib/CalDAV/Principal/ProxyWrite.php ' ,
114116 'OCA \\DAV \\CalDAV \\Principal \\User ' => __DIR__ . '/.. ' . '/../lib/CalDAV/Principal/User.php ' ,
115117 'OCA \\DAV \\CalDAV \\Proxy \\Proxy ' => __DIR__ . '/.. ' . '/../lib/CalDAV/Proxy/Proxy.php ' ,
116118 'OCA \\DAV \\CalDAV \\Proxy \\ProxyMapper ' => __DIR__ . '/.. ' . '/../lib/CalDAV/Proxy/ProxyMapper.php ' ,
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ /**
6+ * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
7+ * SPDX-License-Identifier: AGPL-3.0-or-later
8+ */
9+
10+ namespace OCA \DAV \CalDAV \Principal ;
11+
12+ use Sabre \DAVACL ;
13+
14+ class ProxyRead extends \Sabre \CalDAV \Principal \ProxyRead implements DAVACL \IACL {
15+ use DAVACL \ACLTrait;
16+
17+ /**
18+ * @inheritDoc
19+ */
20+ public function getOwner () {
21+ return $ this ->principalInfo ['uri ' ];
22+ }
23+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ /**
6+ * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
7+ * SPDX-License-Identifier: AGPL-3.0-or-later
8+ */
9+
10+ namespace OCA \DAV \CalDAV \Principal ;
11+
12+ use Sabre \DAVACL ;
13+
14+ class ProxyWrite extends \Sabre \CalDAV \Principal \ProxyWrite implements DAVACL \IACL {
15+ use DAVACL \ACLTrait;
16+
17+ /**
18+ * @inheritDoc
19+ */
20+ public function getOwner () {
21+ return $ this ->principalInfo ['uri ' ];
22+ }
23+ }
Original file line number Diff line number Diff line change @@ -36,4 +36,44 @@ public function getACL() {
3636 ];
3737 return $ acl ;
3838 }
39+
40+ /**
41+ * Returns a specific child node, referenced by its name.
42+ *
43+ * @param string $name
44+ *
45+ * @return \Sabre\DAV\INode
46+ */
47+ public function getChild ($ name ) {
48+ $ principal = $ this ->principalBackend ->getPrincipalByPath ($ this ->getPrincipalURL () . '/ ' . $ name );
49+ if (!$ principal ) {
50+ throw new \Sabre \DAV \Exception \NotFound ("Node with name $ name was not found " );
51+ }
52+ if ($ name === 'calendar-proxy-read ' ) {
53+ return new ProxyRead ($ this ->principalBackend , $ this ->principalProperties );
54+ }
55+
56+ if ($ name === 'calendar-proxy-write ' ) {
57+ return new ProxyWrite ($ this ->principalBackend , $ this ->principalProperties );
58+ }
59+
60+ throw new \Sabre \DAV \Exception \NotFound ("Node with name $ name was not found " );
61+ }
62+
63+ /**
64+ * Returns an array with all the child nodes.
65+ *
66+ * @return \Sabre\DAV\INode[]
67+ */
68+ public function getChildren () {
69+ $ r = [];
70+ if ($ this ->principalBackend ->getPrincipalByPath ($ this ->getPrincipalURL () . '/calendar-proxy-read ' )) {
71+ $ r [] = new ProxyRead ($ this ->principalBackend , $ this ->principalProperties );
72+ }
73+ if ($ this ->principalBackend ->getPrincipalByPath ($ this ->getPrincipalURL () . '/calendar-proxy-write ' )) {
74+ $ r [] = new ProxyWrite ($ this ->principalBackend , $ this ->principalProperties );
75+ }
76+
77+ return $ r ;
78+ }
3979}
Original file line number Diff line number Diff line change @@ -20,4 +20,11 @@ Feature: calendar delegation
2020 When "admin" updates property "{DAV:}group-member-set" to href "/remote.php/dav/principals/users/user0" of principal "users/admin/calendar-proxy-write" on the endpoint "/remote.php/dav/principals/"
2121 Then The CalDAV response should be multi status
2222 And The CalDAV response should contain an href "/remote.php/dav/principals/users/admin/calendar-proxy-write"
23- And The CalDAV response should contain a property "{DAV:}group-member-set"
23+ And The CalDAV response should contain a property "{DAV:}group-member-set"
24+
25+ Scenario : Admin cannot grant User1 access to User0's calendar account
26+ Given user "admin" exists
27+ And user "user0" exists
28+ And user "user1" exists
29+ When "admin" updates property "{DAV:}group-member-set" to href "/remote.php/dav/principals/users/user1" of principal "users/user0/calendar-proxy-write" on the endpoint "/remote.php/dav/principals/"
30+ Then The CalDAV HTTP status code should be "404"
Original file line number Diff line number Diff line change @@ -408,19 +408,23 @@ public function updatesHrefPropertyOfPrincipal(
408408 $ xml = new \Sabre \Xml \Service ();
409409 $ body = $ xml ->write ('{DAV:}propertyupdate ' , $ propPatch , '/ ' );
410410
411- $ this ->response = $ this ->client ->request (
412- 'PROPPATCH ' ,
413- $ davUrl ,
414- [
415- 'headers ' => [
416- 'Content-Type ' => 'application/xml; charset=UTF-8 ' ,
417- ],
418- 'body ' => $ body ,
419- 'auth ' => [
420- $ user ,
421- $ password ,
422- ],
423- ]
424- );
411+ try {
412+ $ this ->response = $ this ->client ->request (
413+ 'PROPPATCH ' ,
414+ $ davUrl ,
415+ [
416+ 'headers ' => [
417+ 'Content-Type ' => 'application/xml; charset=UTF-8 ' ,
418+ ],
419+ 'body ' => $ body ,
420+ 'auth ' => [
421+ $ user ,
422+ $ password ,
423+ ],
424+ ]
425+ );
426+ } catch (\GuzzleHttp \Exception \ClientException $ e ) {
427+ $ this ->response = $ e ->getResponse ();
428+ }
425429 }
426430}
You can’t perform that action at this time.
0 commit comments