]> source.dussan.org Git - nextcloud-server.git/commitdiff
Save access properly
authorThomas Müller <thomas.mueller@tmit.eu>
Tue, 12 Jan 2016 12:40:00 +0000 (13:40 +0100)
committerThomas Müller <thomas.mueller@tmit.eu>
Mon, 18 Jan 2016 21:14:51 +0000 (22:14 +0100)
apps/dav/lib/carddav/carddavbackend.php

index 3a98fd6e8104887542dbe3179d56bf350f7e3725..d0cfc61b7c4de4b9f45eb98de95dbd895d4ce5d9 100644 (file)
@@ -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();