aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-02-09 15:03:15 +0100
committerJoas Schilling <nickvergessen@owncloud.com>2016-02-29 16:49:55 +0100
commit95e218b00c9526bf3cba8ce719b09b1ea9d49ba9 (patch)
treeee79f3605da9052aba89d39cbaaed31d1f333bae /apps/dav
parentd98217d8ba90fd0082b055d55e96c03fac9bb4c3 (diff)
downloadnextcloud-server-95e218b00c9526bf3cba8ce719b09b1ea9d49ba9.tar.gz
nextcloud-server-95e218b00c9526bf3cba8ce719b09b1ea9d49ba9.zip
For 9.0 we don't have the possibility to store calendar and addressbook properties on a per-user basis and therefore we simple don't allow this for now
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/caldav/calendar.php8
-rw-r--r--apps/dav/lib/carddav/addressbook.php14
-rw-r--r--apps/dav/tests/unit/caldav/calendartest.php16
-rw-r--r--apps/dav/tests/unit/carddav/addressbooktest.php16
4 files changed, 51 insertions, 3 deletions
diff --git a/apps/dav/lib/caldav/calendar.php b/apps/dav/lib/caldav/calendar.php
index 6b34d570eb3..738b366b08d 100644
--- a/apps/dav/lib/caldav/calendar.php
+++ b/apps/dav/lib/caldav/calendar.php
@@ -4,6 +4,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 {
@@ -103,4 +104,11 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
}
parent::delete();
}
+
+ function propPatch(PropPatch $propPatch) {
+ if (isset($this->calendarInfo['{http://owncloud.org/ns}owner-principal'])) {
+ 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/tests/unit/caldav/calendartest.php b/apps/dav/tests/unit/caldav/calendartest.php
index 4a3c94e8aba..4a4de51e60a 100644
--- a/apps/dav/tests/unit/caldav/calendartest.php
+++ b/apps/dav/tests/unit/caldav/calendartest.php
@@ -23,6 +23,7 @@ namespace OCA\DAV\Tests\Unit\CalDAV;
use OCA\DAV\CalDAV\CalDavBackend;
use OCA\DAV\CalDAV\Calendar;
+use Sabre\DAV\PropPatch;
use Test\TestCase;
class CalendarTest extends TestCase {
@@ -63,4 +64,19 @@ class CalendarTest extends TestCase {
$c = new Calendar($backend, $calendarInfo);
$c->delete();
}
+
+ /**
+ * @expectedException \Sabre\DAV\Exception\Forbidden
+ */
+ public function testPropPatch() {
+ /** @var \PHPUnit_Framework_MockObject_MockObject | CalDavBackend $backend */
+ $backend = $this->getMockBuilder('OCA\DAV\CalDAV\CalDavBackend')->disableOriginalConstructor()->getMock();
+ $calendarInfo = [
+ '{http://owncloud.org/ns}owner-principal' => 'user1',
+ 'principaluri' => 'user2',
+ 'id' => 666
+ ];
+ $c = new Calendar($backend, $calendarInfo);
+ $c->propPatch(new PropPatch([]));
+ }
}
diff --git a/apps/dav/tests/unit/carddav/addressbooktest.php b/apps/dav/tests/unit/carddav/addressbooktest.php
index d714fc71679..854c121a95d 100644
--- a/apps/dav/tests/unit/carddav/addressbooktest.php
+++ b/apps/dav/tests/unit/carddav/addressbooktest.php
@@ -23,6 +23,7 @@ namespace OCA\DAV\Tests\Unit\CardDAV;
use OCA\DAV\CardDAV\AddressBook;
use OCA\DAV\CardDAV\CardDavBackend;
+use Sabre\DAV\PropPatch;
use Test\TestCase;
class AddressBookTest extends TestCase {
@@ -61,4 +62,19 @@ class AddressBookTest extends TestCase {
$c = new AddressBook($backend, $calendarInfo);
$c->delete();
}
+
+ /**
+ * @expectedException \Sabre\DAV\Exception\Forbidden
+ */
+ public function testPropPatch() {
+ /** @var \PHPUnit_Framework_MockObject_MockObject | CardDavBackend $backend */
+ $backend = $this->getMockBuilder('OCA\DAV\CardDAV\CardDavBackend')->disableOriginalConstructor()->getMock();
+ $calendarInfo = [
+ '{http://owncloud.org/ns}owner-principal' => 'user1',
+ 'principaluri' => 'user2',
+ 'id' => 666
+ ];
+ $c = new AddressBook($backend, $calendarInfo);
+ $c->propPatch(new PropPatch([]));
+ }
}