summaryrefslogtreecommitdiffstats
path: root/lib/public/contacts.php
diff options
context:
space:
mode:
authorThomas Mueller <thomas.mueller@tmit.eu>2012-11-24 00:01:58 +0100
committerThomas Mueller <thomas.mueller@tmit.eu>2012-11-28 23:10:00 +0100
commit2d597c2238c40ff0291fc80a4807aee6fc7bc4fc (patch)
tree7c804972b54f734091ba87d9189580327ef6ce55 /lib/public/contacts.php
parent5b1dea56e551df1306bd2046c3d06f1e589b4c03 (diff)
downloadnextcloud-server-2d597c2238c40ff0291fc80a4807aee6fc7bc4fc.tar.gz
nextcloud-server-2d597c2238c40ff0291fc80a4807aee6fc7bc4fc.zip
first unit tests implemented
Diffstat (limited to 'lib/public/contacts.php')
-rw-r--r--lib/public/contacts.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/public/contacts.php b/lib/public/contacts.php
index 36195ef9c24..d14806bd0c4 100644
--- a/lib/public/contacts.php
+++ b/lib/public/contacts.php
@@ -67,7 +67,7 @@ namespace OC {
/**
* @return mixed
*/
- public function isReadOnly();
+ public function getPermissions();
/**
* @param $id
@@ -129,7 +129,7 @@ namespace OCP {
return null;
$address_book = self::$address_books[$address_book_key];
- if ($address_book->isReadOnly())
+ if ($address_book->getPermissions() & \OCP\PERMISSION_DELETE)
return null;
return $address_book->delete($id);
@@ -149,7 +149,7 @@ namespace OCP {
return null;
$address_book = self::$address_books[$address_book_key];
- if ($address_book->isReadOnly())
+ if ($address_book->getPermissions() & \OCP\PERMISSION_CREATE)
return null;
return $address_book->createOrUpdate($properties);
@@ -191,8 +191,15 @@ namespace OCP {
}
/**
+ * removes all registered address book instances
+ */
+ public static function clear() {
+ self::$address_books = array();
+ }
+
+ /**
* @var \OC\IAddressBook[] which holds all registered address books
*/
private static $address_books = array();
}
-} \ No newline at end of file
+}