From: Thomas Müller Date: Tue, 12 Jan 2016 12:40:00 +0000 (+0100) Subject: Save access properly X-Git-Tag: v9.0beta1~249^2~5 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=dca0a0eaf1133b0523acfc4074856485ece51093;p=nextcloud-server.git Save access properly --- diff --git a/apps/dav/lib/carddav/carddavbackend.php b/apps/dav/lib/carddav/carddavbackend.php index 3a98fd6e810..d0cfc61b7c4 100644 --- a/apps/dav/lib/carddav/carddavbackend.php +++ b/apps/dav/lib/carddav/carddavbackend.php @@ -785,7 +785,10 @@ class CardDavBackend implements BackendInterface, SyncSupport { // remove the share if it already exists $this->unshare($addressBookUri, $element['href']); - $access = $element['readOnly'] ? self::ACCESS_READ : self::ACCESS_READ_WRITE; + $access = self::ACCESS_READ; + if (isset($element['readOnly'])) { + $access = $element['readOnly'] ? self::ACCESS_READ : self::ACCESS_READ_WRITE; + } $newUri = sha1($addressBookUri . $addressBook['principaluri']); $query = $this->db->getQueryBuilder(); @@ -794,7 +797,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { 'principaluri' => $query->createNamedParameter($parts[1]), 'uri' => $query->createNamedParameter($newUri), 'type' => $query->createNamedParameter('addressbook'), - 'access' => $query->createNamedParameter(0), + 'access' => $query->createNamedParameter($access), 'resourceid' => $query->createNamedParameter($addressBook['id']) ]); $query->execute();