aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/CalDAV
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-03-02 11:34:27 +0100
committerJoas Schilling <coding@schilljs.com>2017-03-02 12:28:57 +0100
commit2eb27c636d7fc73e9d25f8531b49f96908506a19 (patch)
treebfb750dcff89447e5afa41267e51d2a2010c1b0a /apps/dav/lib/CalDAV
parent6dbdca0721902cf9224f8ec42ff5170810afd388 (diff)
downloadnextcloud-server-2eb27c636d7fc73e9d25f8531b49f96908506a19.tar.gz
nextcloud-server-2eb27c636d7fc73e9d25f8531b49f96908506a19.zip
Make sure shares use read-write when available
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/dav/lib/CalDAV')
-rw-r--r--apps/dav/lib/CalDAV/CalDavBackend.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php
index e8f1cf979a5..dbe86438238 100644
--- a/apps/dav/lib/CalDAV/CalDavBackend.php
+++ b/apps/dav/lib/CalDAV/CalDavBackend.php
@@ -277,9 +277,19 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY)
->execute();
+ $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
while($row = $result->fetch()) {
+ $readOnly = (int) $row['access'] === Backend::ACCESS_READ;
if (isset($calendars[$row['id']])) {
- continue;
+ if ($readOnly) {
+ // New share can not have more permissions then the old one.
+ continue;
+ }
+ if (isset($calendars[$row['id']][$readOnlyPropertyName]) &&
+ $calendars[$row['id']][$readOnlyPropertyName] === 0) {
+ // Old share is already read-write, no more permissions can be gained
+ continue;
+ }
}
list(, $name) = URLUtil::splitPath($row['principaluri']);
@@ -298,7 +308,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
- '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ,
+ $readOnlyPropertyName => $readOnly,
];
foreach($this->propertyMap as $xmlName=>$dbName) {