summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2013-06-20 09:07:16 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2013-06-20 09:07:16 (GMT)
commitdcd7143bd9a2914bfa9dcf1af51915ef24d9b168 (patch)
treec21667f4ba49f184eb09b89dd3a73bff4212de75
parent5730dd9cea7f5bef24861964aa02a37ea3d6ffe1 (diff)
downloadiRony-dcd7143bd9a2914bfa9dcf1af51915ef24d9b168.tar.gz
Implement contact card deletion function
-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;
}