From 2d597c2238c40ff0291fc80a4807aee6fc7bc4fc Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Sat, 24 Nov 2012 00:01:58 +0100 Subject: first unit tests implemented --- lib/public/contacts.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'lib/public/contacts.php') 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); @@ -190,9 +190,16 @@ namespace OCP { return $result; } + /** + * 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 +} -- cgit v1.2.3