diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-03-07 12:42:52 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-03-07 12:42:52 +0100 |
commit | 296a46cc387fb64ce4f55c3c2d07b1bcd6301e55 (patch) | |
tree | 87401ad12d597bc16c92b02344fb5d580e9c9e6d /apps/dav/lib | |
parent | c07b731689de6fe754e108688ccf71342aad95ef (diff) | |
parent | 7a46b30c94991b5325825065898dc7d5f14457c2 (diff) | |
download | nextcloud-server-296a46cc387fb64ce4f55c3c2d07b1bcd6301e55.tar.gz nextcloud-server-296a46cc387fb64ce4f55c3c2d07b1bcd6301e55.zip |
Merge pull request #22244 from owncloud/dont-update-shared-resource-properties
For 9.0 we don't have the possibility to store calendar and addressbo…
Diffstat (limited to 'apps/dav/lib')
-rw-r--r-- | apps/dav/lib/caldav/calendar.php | 10 | ||||
-rw-r--r-- | apps/dav/lib/carddav/addressbook.php | 14 | ||||
-rw-r--r-- | apps/dav/lib/dav/sharing/backend.php | 8 |
3 files changed, 29 insertions, 3 deletions
diff --git a/apps/dav/lib/caldav/calendar.php b/apps/dav/lib/caldav/calendar.php index 16acbbf53a3..55f1acec396 100644 --- a/apps/dav/lib/caldav/calendar.php +++ b/apps/dav/lib/caldav/calendar.php @@ -23,6 +23,7 @@ namespace OCA\DAV\CalDAV; use OCA\DAV\DAV\Sharing\IShareable; use Sabre\DAV\Exception\Forbidden; +use Sabre\DAV\PropPatch; class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { @@ -122,4 +123,13 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { } parent::delete(); } + + function propPatch(PropPatch $propPatch) { + $mutations = $propPatch->getMutations(); + // If this is a shared calendar, the user can only change the enabled property, to hide it. + if (isset($this->calendarInfo['{http://owncloud.org/ns}owner-principal']) && (sizeof($mutations) !== 1 || !isset($mutations['{http://owncloud.org/ns}calendar-enabled']))) { + throw new Forbidden(); + } + parent::propPatch($propPatch); + } } diff --git a/apps/dav/lib/carddav/addressbook.php b/apps/dav/lib/carddav/addressbook.php index be57a2d90a1..6ae938b8e29 100644 --- a/apps/dav/lib/carddav/addressbook.php +++ b/apps/dav/lib/carddav/addressbook.php @@ -23,6 +23,7 @@ namespace OCA\DAV\CardDAV; use OCA\DAV\DAV\Sharing\IShareable; use Sabre\DAV\Exception\Forbidden; use Sabre\DAV\Exception\NotFound; +use Sabre\DAV\PropPatch; class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { @@ -83,14 +84,14 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { } // add the current user - if (isset($this->addressBookInfo['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'])) { - $owner = $this->addressBookInfo['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal']; + if (isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) { + $owner = $this->addressBookInfo['{http://owncloud.org/ns}owner-principal']; $acl[] = [ 'privilege' => '{DAV:}read', 'principal' => $owner, 'protected' => true, ]; - if ($this->addressBookInfo['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only']) { + if ($this->addressBookInfo['{http://owncloud.org/ns}read-only']) { $acl[] = [ 'privilege' => '{DAV:}write', 'principal' => $owner, @@ -162,6 +163,13 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable { parent::delete(); } + function propPatch(PropPatch $propPatch) { + if (isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) { + throw new Forbidden(); + } + parent::propPatch($propPatch); + } + public function getContactsGroups() { /** @var CardDavBackend $cardDavBackend */ $cardDavBackend = $this->carddavBackend; diff --git a/apps/dav/lib/dav/sharing/backend.php b/apps/dav/lib/dav/sharing/backend.php index 8e2a9307b70..ffc4193e34b 100644 --- a/apps/dav/lib/dav/sharing/backend.php +++ b/apps/dav/lib/dav/sharing/backend.php @@ -190,6 +190,14 @@ class Backend { 'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'], 'protected' => true, ]; + } else if ($this->resourceType === 'calendar') { + // Allow changing the properties of read only calendars, + // so users can change the visibility. + $acl[] = [ + 'privilege' => '{DAV:}write-properties', + 'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'], + 'protected' => true, + ]; } } return $acl; |