mirror of
https://github.com/nextcloud/server.git
synced 2026-05-19 08:25:56 -04:00
Merge pull request #59967 from nextcloud/backport/59693/stable29
Some checks failed
Integration sqlite / changes (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, --tags ~@large files_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, capabilities_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, collaboration_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, comments_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, dav_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, federation_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, filesdrop_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, ldap_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, openldap_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, openldap_numerical_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, remoteapi_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, setup_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, sharees_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, sharing_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, videoverification_features) (push) Has been cancelled
Integration sqlite / integration-sqlite-summary (push) Has been cancelled
Some checks failed
Integration sqlite / changes (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, --tags ~@large files_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, capabilities_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, collaboration_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, comments_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, dav_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, federation_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, filesdrop_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, ldap_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, openldap_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, openldap_numerical_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, remoteapi_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, setup_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, sharees_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, sharing_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.2, stable29, videoverification_features) (push) Has been cancelled
Integration sqlite / integration-sqlite-summary (push) Has been cancelled
This commit is contained in:
commit
62f01bc507
7 changed files with 190 additions and 28 deletions
|
|
@ -69,6 +69,8 @@ return array(
|
|||
'OCA\\DAV\\CalDAV\\Outbox' => $baseDir . '/../lib/CalDAV/Outbox.php',
|
||||
'OCA\\DAV\\CalDAV\\Plugin' => $baseDir . '/../lib/CalDAV/Plugin.php',
|
||||
'OCA\\DAV\\CalDAV\\Principal\\Collection' => $baseDir . '/../lib/CalDAV/Principal/Collection.php',
|
||||
'OCA\\DAV\\CalDAV\\Principal\\ProxyRead' => $baseDir . '/../lib/CalDAV/Principal/ProxyRead.php',
|
||||
'OCA\\DAV\\CalDAV\\Principal\\ProxyWrite' => $baseDir . '/../lib/CalDAV/Principal/ProxyWrite.php',
|
||||
'OCA\\DAV\\CalDAV\\Principal\\User' => $baseDir . '/../lib/CalDAV/Principal/User.php',
|
||||
'OCA\\DAV\\CalDAV\\Proxy\\Proxy' => $baseDir . '/../lib/CalDAV/Proxy/Proxy.php',
|
||||
'OCA\\DAV\\CalDAV\\Proxy\\ProxyMapper' => $baseDir . '/../lib/CalDAV/Proxy/ProxyMapper.php',
|
||||
|
|
|
|||
|
|
@ -84,6 +84,8 @@ class ComposerStaticInitDAV
|
|||
'OCA\\DAV\\CalDAV\\Outbox' => __DIR__ . '/..' . '/../lib/CalDAV/Outbox.php',
|
||||
'OCA\\DAV\\CalDAV\\Plugin' => __DIR__ . '/..' . '/../lib/CalDAV/Plugin.php',
|
||||
'OCA\\DAV\\CalDAV\\Principal\\Collection' => __DIR__ . '/..' . '/../lib/CalDAV/Principal/Collection.php',
|
||||
'OCA\\DAV\\CalDAV\\Principal\\ProxyRead' => __DIR__ . '/..' . '/../lib/CalDAV/Principal/ProxyRead.php',
|
||||
'OCA\\DAV\\CalDAV\\Principal\\ProxyWrite' => __DIR__ . '/..' . '/../lib/CalDAV/Principal/ProxyWrite.php',
|
||||
'OCA\\DAV\\CalDAV\\Principal\\User' => __DIR__ . '/..' . '/../lib/CalDAV/Principal/User.php',
|
||||
'OCA\\DAV\\CalDAV\\Proxy\\Proxy' => __DIR__ . '/..' . '/../lib/CalDAV/Proxy/Proxy.php',
|
||||
'OCA\\DAV\\CalDAV\\Proxy\\ProxyMapper' => __DIR__ . '/..' . '/../lib/CalDAV/Proxy/ProxyMapper.php',
|
||||
|
|
|
|||
23
apps/dav/lib/CalDAV/Principal/ProxyRead.php
Normal file
23
apps/dav/lib/CalDAV/Principal/ProxyRead.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCA\DAV\CalDAV\Principal;
|
||||
|
||||
use Sabre\DAVACL;
|
||||
|
||||
class ProxyRead extends \Sabre\CalDAV\Principal\ProxyRead implements DAVACL\IACL {
|
||||
use DAVACL\ACLTrait;
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getOwner() {
|
||||
return $this->principalInfo['uri'];
|
||||
}
|
||||
}
|
||||
23
apps/dav/lib/CalDAV/Principal/ProxyWrite.php
Normal file
23
apps/dav/lib/CalDAV/Principal/ProxyWrite.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCA\DAV\CalDAV\Principal;
|
||||
|
||||
use Sabre\DAVACL;
|
||||
|
||||
class ProxyWrite extends \Sabre\CalDAV\Principal\ProxyWrite implements DAVACL\IACL {
|
||||
use DAVACL\ACLTrait;
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getOwner() {
|
||||
return $this->principalInfo['uri'];
|
||||
}
|
||||
}
|
||||
|
|
@ -51,4 +51,44 @@ class User extends \Sabre\CalDAV\Principal\User {
|
|||
];
|
||||
return $acl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a specific child node, referenced by its name.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return \Sabre\DAV\INode
|
||||
*/
|
||||
public function getChild($name) {
|
||||
$principal = $this->principalBackend->getPrincipalByPath($this->getPrincipalURL() . '/' . $name);
|
||||
if (!$principal) {
|
||||
throw new \Sabre\DAV\Exception\NotFound("Node with name $name was not found");
|
||||
}
|
||||
if ($name === 'calendar-proxy-read') {
|
||||
return new ProxyRead($this->principalBackend, $this->principalProperties);
|
||||
}
|
||||
|
||||
if ($name === 'calendar-proxy-write') {
|
||||
return new ProxyWrite($this->principalBackend, $this->principalProperties);
|
||||
}
|
||||
|
||||
throw new \Sabre\DAV\Exception\NotFound("Node with name $name was not found");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array with all the child nodes.
|
||||
*
|
||||
* @return \Sabre\DAV\INode[]
|
||||
*/
|
||||
public function getChildren() {
|
||||
$r = [];
|
||||
if ($this->principalBackend->getPrincipalByPath($this->getPrincipalURL() . '/calendar-proxy-read')) {
|
||||
$r[] = new ProxyRead($this->principalBackend, $this->principalProperties);
|
||||
}
|
||||
if ($this->principalBackend->getPrincipalByPath($this->getPrincipalURL() . '/calendar-proxy-write')) {
|
||||
$r[] = new ProxyWrite($this->principalBackend, $this->principalProperties);
|
||||
}
|
||||
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
30
build/integration/dav_features/caldav-delegation.feature
Normal file
30
build/integration/dav_features/caldav-delegation.feature
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
Feature: calendar delegation
|
||||
Calendar delegation grants another user/principal control of a calendar account,
|
||||
including all calendars the delegator can access.
|
||||
|
||||
@caldav-delegation
|
||||
Scenario: admin grants user0 read access to her calendar account
|
||||
Given user "admin" exists
|
||||
And user "user0" exists
|
||||
When "admin" updates property "{DAV:}group-member-set" to href "/remote.php/dav/principals/users/user0" of principal "users/admin/calendar-proxy-read" on the endpoint "/remote.php/dav/principals/"
|
||||
Then The CalDAV response should be multi status
|
||||
And The CalDAV response should contain an href "/remote.php/dav/principals/users/admin/calendar-proxy-read"
|
||||
And The CalDAV response should contain a property "{DAV:}group-member-set"
|
||||
|
||||
@caldav-delegation
|
||||
Scenario: admin grants write access to her calendar account
|
||||
Given user "admin" exists
|
||||
And user "user0" exists
|
||||
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/"
|
||||
Then The CalDAV response should be multi status
|
||||
And The CalDAV response should contain an href "/remote.php/dav/principals/users/admin/calendar-proxy-write"
|
||||
And The CalDAV response should contain a property "{DAV:}group-member-set"
|
||||
|
||||
Scenario: Admin cannot grant User1 access to User0's calendar account
|
||||
Given user "admin" exists
|
||||
And user "user0" exists
|
||||
And user "user1" exists
|
||||
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/"
|
||||
Then The CalDAV HTTP status code should be "404"
|
||||
|
|
@ -62,21 +62,39 @@ class CalDavContext implements \Behat\Behat\Context\Context {
|
|||
|
||||
/** @AfterScenario */
|
||||
public function afterScenario() {
|
||||
$davUrl = $this->baseUrl. '/remote.php/dav/calendars/admin/MyCalendar';
|
||||
try {
|
||||
$this->client->delete(
|
||||
$davUrl,
|
||||
[
|
||||
'auth' => [
|
||||
'admin',
|
||||
'admin',
|
||||
],
|
||||
'headers' => [
|
||||
'X-NC-CalDAV-No-Trashbin' => '1',
|
||||
foreach (['MyCalendar', 'MyCalendar2'] as $calendarName) {
|
||||
try {
|
||||
$this->client->delete(
|
||||
$this->baseUrl . '/remote.php/dav/calendars/admin/' . $calendarName,
|
||||
[
|
||||
'auth' => ['admin', 'admin'],
|
||||
'headers' => ['X-NC-CalDAV-No-Trashbin' => '1'],
|
||||
]
|
||||
]
|
||||
);
|
||||
} catch (\GuzzleHttp\Exception\ClientException $e) {
|
||||
);
|
||||
} catch (\GuzzleHttp\Exception\ClientException $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** @AfterScenario @caldav-delegation */
|
||||
public function afterDelegationScenario() {
|
||||
foreach (['calendar-proxy-read', 'calendar-proxy-write'] as $proxyType) {
|
||||
try {
|
||||
$propPatch = new \Sabre\DAV\Xml\Request\PropPatch();
|
||||
$propPatch->properties = ['{DAV:}group-member-set' => new \Sabre\DAV\Xml\Property\Href([])];
|
||||
$xml = new \Sabre\Xml\Service();
|
||||
$body = $xml->write('{DAV:}propertyupdate', $propPatch, '/');
|
||||
$this->client->request(
|
||||
'PROPPATCH',
|
||||
$this->baseUrl . '/remote.php/dav/principals/users/admin/' . $proxyType,
|
||||
[
|
||||
'headers' => ['Content-Type' => 'application/xml; charset=UTF-8'],
|
||||
'body' => $body,
|
||||
'auth' => ['admin', 'admin'],
|
||||
]
|
||||
);
|
||||
} catch (\GuzzleHttp\Exception\ClientException $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -194,6 +212,26 @@ class CalDavContext implements \Behat\Behat\Context\Context {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then The CalDAV response should contain an href :href
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function theCaldavResponseShouldContainAnHref(string $href): void {
|
||||
/** @var \Sabre\DAV\Xml\Response\MultiStatus $multiStatus */
|
||||
$multiStatus = $this->responseXml['value'];
|
||||
foreach ($multiStatus->getResponses() as $response) {
|
||||
if ($response->getHref() === $href) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new \Exception(
|
||||
sprintf(
|
||||
'Expected href %s not found in response',
|
||||
$href,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then The CalDAV response should be multi status
|
||||
* @throws \Exception
|
||||
|
|
@ -392,19 +430,23 @@ class CalDavContext implements \Behat\Behat\Context\Context {
|
|||
$xml = new \Sabre\Xml\Service();
|
||||
$body = $xml->write('{DAV:}propertyupdate', $propPatch, '/');
|
||||
|
||||
$this->response = $this->client->request(
|
||||
'PROPPATCH',
|
||||
$davUrl,
|
||||
[
|
||||
'headers' => [
|
||||
'Content-Type' => 'application/xml; charset=UTF-8',
|
||||
],
|
||||
'body' => $body,
|
||||
'auth' => [
|
||||
$user,
|
||||
$password,
|
||||
],
|
||||
]
|
||||
);
|
||||
try {
|
||||
$this->response = $this->client->request(
|
||||
'PROPPATCH',
|
||||
$davUrl,
|
||||
[
|
||||
'headers' => [
|
||||
'Content-Type' => 'application/xml; charset=UTF-8',
|
||||
],
|
||||
'body' => $body,
|
||||
'auth' => [
|
||||
$user,
|
||||
$password,
|
||||
],
|
||||
]
|
||||
);
|
||||
} catch (\GuzzleHttp\Exception\ClientException $e) {
|
||||
$this->response = $e->getResponse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue