diff options
Diffstat (limited to '3rdparty/Sabre/CardDAV/AddressBook.php')
-rwxr-xr-x[-rw-r--r--] | 3rdparty/Sabre/CardDAV/AddressBook.php | 125 |
1 files changed, 71 insertions, 54 deletions
diff --git a/3rdparty/Sabre/CardDAV/AddressBook.php b/3rdparty/Sabre/CardDAV/AddressBook.php index 471ca7b338a..3b381e1eea3 100644..100755 --- a/3rdparty/Sabre/CardDAV/AddressBook.php +++ b/3rdparty/Sabre/CardDAV/AddressBook.php @@ -7,34 +7,33 @@ * * @package Sabre * @subpackage CardDAV - * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved. - * @author Evert Pot (http://www.rooftopsolutions.nl/) + * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved. + * @author Evert Pot (http://www.rooftopsolutions.nl/) * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License */ class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_CardDAV_IAddressBook, Sabre_DAV_IProperties, Sabre_DAVACL_IACL { /** - * This is an array with addressbook information - * - * @var array + * This is an array with addressbook information + * + * @var array */ private $addressBookInfo; /** - * CardDAV backend - * - * @var Sabre_CardDAV_Backend_Abstract + * CardDAV backend + * + * @var Sabre_CardDAV_Backend_Abstract */ private $carddavBackend; /** - * Constructor - * - * @param Sabre_CardDAV_Backend_Abstract $carddavBackend - * @param array $addressBookInfo - * @return void + * Constructor + * + * @param Sabre_CardDAV_Backend_Abstract $carddavBackend + * @param array $addressBookInfo */ - public function __construct(Sabre_CardDAV_Backend_Abstract $carddavBackend,array $addressBookInfo) { + public function __construct(Sabre_CardDAV_Backend_Abstract $carddavBackend, array $addressBookInfo) { $this->carddavBackend = $carddavBackend; $this->addressBookInfo = $addressBookInfo; @@ -42,9 +41,9 @@ class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_Ca } /** - * Returns the name of the addressbook - * - * @return string + * Returns the name of the addressbook + * + * @return string */ public function getName() { @@ -55,21 +54,21 @@ class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_Ca /** * Returns a card * - * @param string $name + * @param string $name * @return Sabre_DAV_Card */ public function getChild($name) { $obj = $this->carddavBackend->getCard($this->addressBookInfo['id'],$name); - if (!$obj) throw new Sabre_DAV_Exception_FileNotFound('Card not found'); + if (!$obj) throw new Sabre_DAV_Exception_NotFound('Card not found'); return new Sabre_CardDAV_Card($this->carddavBackend,$this->addressBookInfo,$obj); } /** * Returns the full list of cards - * - * @return array + * + * @return array */ public function getChildren() { @@ -85,9 +84,9 @@ class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_Ca /** * Creates a new directory * - * We actually block this, as subdirectories are not allowed in addressbooks. - * - * @param string $name + * We actually block this, as subdirectories are not allowed in addressbooks. + * + * @param string $name * @return void */ public function createDirectory($name) { @@ -99,11 +98,13 @@ class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_Ca /** * Creates a new file * - * The contents of the new file must be a valid VCARD - * - * @param string $name - * @param resource $vcardData - * @return void + * The contents of the new file must be a valid VCARD. + * + * This method may return an ETag. + * + * @param string $name + * @param resource $vcardData + * @return void|null */ public function createFile($name,$vcardData = null) { @@ -111,13 +112,13 @@ class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_Ca // Converting to UTF-8, if needed $vcardData = Sabre_DAV_StringUtil::ensureUTF8($vcardData); - $this->carddavBackend->createCard($this->addressBookInfo['id'],$name,$vcardData); + return $this->carddavBackend->createCard($this->addressBookInfo['id'],$name,$vcardData); } /** - * Deletes the entire addressbook. - * + * Deletes the entire addressbook. + * * @return void */ public function delete() { @@ -128,8 +129,8 @@ class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_Ca /** * Renames the addressbook - * - * @param string $newName + * + * @param string $newName * @return void */ public function setName($newName) { @@ -140,7 +141,7 @@ class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_Ca /** * Returns the last modification date as a unix timestamp. - * + * * @return void */ public function getLastModified() { @@ -162,7 +163,7 @@ class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_Ca * If the operation was successful, true can be returned. * If the operation failed, false can be returned. * - * Deletion of a non-existant property is always succesful. + * Deletion of a non-existent property is always successful. * * Lastly, it is optional to return detailed information about any * failures. In this case an array should be returned with the following @@ -177,16 +178,16 @@ class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_Ca * ) * ) * - * In this example it was forbidden to update {DAV:}displayname. + * In this example it was forbidden to update {DAV:}displayname. * (403 Forbidden), which in turn also caused {DAV:}owner to fail * (424 Failed Dependency) because the request needs to be atomic. * - * @param array $mutations - * @return bool|array + * @param array $mutations + * @return bool|array */ public function updateProperties($mutations) { - return $this->carddavBackend->updateAddressBook($this->addressBookInfo['id'], $mutations); + return $this->carddavBackend->updateAddressBook($this->addressBookInfo['id'], $mutations); } @@ -198,8 +199,8 @@ class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_Ca * * If the array is empty, it means 'all properties' were requested. * - * @param array $properties - * @return void + * @param array $properties + * @return array */ public function getProperties($properties) { @@ -221,8 +222,8 @@ class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_Ca /** * Returns the owner principal * - * This must be a url to a principal, or null if there's no owner - * + * This must be a url to a principal, or null if there's no owner + * * @return string|null */ public function getOwner() { @@ -235,8 +236,8 @@ class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_Ca * Returns a group principal * * This must be a url to a principal, or null if there's no owner - * - * @return string|null + * + * @return string|null */ public function getGroup() { @@ -248,13 +249,13 @@ class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_Ca * Returns a list of ACE's for this node. * * Each ACE has the following properties: - * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are + * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are * currently the only supported privileges * * 'principal', a url to the principal who owns the node - * * 'protected' (optional), indicating that this ACE is not allowed to - * be updated. - * - * @return array + * * 'protected' (optional), indicating that this ACE is not allowed to + * be updated. + * + * @return array */ public function getACL() { @@ -277,9 +278,9 @@ class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_Ca /** * Updates the ACL * - * This method will receive a list of new ACE's. - * - * @param array $acl + * This method will receive a list of new ACE's. + * + * @param array $acl * @return void */ public function setACL(array $acl) { @@ -288,6 +289,22 @@ class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_Ca } + /** + * Returns the list of supported privileges for this node. + * + * The returned data structure is a list of nested privileges. + * See Sabre_DAVACL_Plugin::getDefaultSupportedPrivilegeSet for a simple + * standard structure. + * + * If null is returned from this method, the default privilege set is used, + * which is fine for most common usecases. + * + * @return array|null + */ + public function getSupportedPrivilegeSet() { + + return null; + } } |