summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Kolab/CardDAV/ContactsBackend.php20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/Kolab/CardDAV/ContactsBackend.php b/lib/Kolab/CardDAV/ContactsBackend.php
index 85efb3d..7d0dff0 100644
--- a/lib/Kolab/CardDAV/ContactsBackend.php
+++ b/lib/Kolab/CardDAV/ContactsBackend.php
@@ -461,7 +461,25 @@ class ContactsBackend extends CardDAV\Backend\AbstractBackend
public function deleteCard($addressBookId, $cardUri)
{
console(__METHOD__, $addressBookId, $cardUri);
- // TODO: implement this
+
+ $uid = basename($cardUri, '.vcf');
+
+ if ($addressBookId == '__all__') {
+ $this->get_card_by_uid($uid, $storage);
+ }
+ else {
+ $storage = $this->get_storage_folder($addressBookId);
+ }
+
+ if (!$storage || !$this->is_writeable($storage)) {
+ throw new DAV\Exception\MethodNotAllowed('Insufficient privileges to delete this card');
+ }
+
+ if ($storage) {
+ return $storage->delete($uid);
+ }
+
+ return false;
}