summaryrefslogtreecommitdiff
path: root/lib/Kolab/CardDAV/AddressBookRoot.php
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2013-03-14 16:48:10 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2013-03-14 16:48:10 (GMT)
commit5515a4b398f4ccc2b6f32d810d4fb7eed47c3efa (patch)
tree48700a1f304ebe736d70d5a8889d619f4204579a /lib/Kolab/CardDAV/AddressBookRoot.php
parent5ec426a349db1bf8720228b4df4d08388a59b8ab (diff)
downloadiRony-5515a4b398f4ccc2b6f32d810d4fb7eed47c3efa.tar.gz
- Use UIDs from IMAP annoations for collection IDs
- Implement CardDAV/AddressBook classes for proper ACL/sharing support - Enable Free-Busy queries to CalDAV
Diffstat (limited to 'lib/Kolab/CardDAV/AddressBookRoot.php')
-rw-r--r--lib/Kolab/CardDAV/AddressBookRoot.php99
1 files changed, 99 insertions, 0 deletions
diff --git a/lib/Kolab/CardDAV/AddressBookRoot.php b/lib/Kolab/CardDAV/AddressBookRoot.php
new file mode 100644
index 0000000..218c096
--- /dev/null
+++ b/lib/Kolab/CardDAV/AddressBookRoot.php
@@ -0,0 +1,99 @@
+<?php
+
+/**
+ * SabreDAV CalendarRootNode derived class for the Kolab.
+ *
+ * @author Thomas Bruederli <bruederli@kolabsys.com>
+ *
+ * Copyright (C) 2013, Kolab Systems AG <contact@kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+namespace Kolab\CardDAV;
+
+use Sabre\DAVACL;
+use Sabre\CardDav\Backend;
+
+/**
+ * AddressBook rootnode
+ *
+ * This object lists a collection of users, which can contain addressbooks.
+ *
+ * @copyright Copyright (C) 2007-2013 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 AddressBookRoot extends DAVACL\AbstractPrincipalCollection
+{
+ /**
+ * Principal Backend
+ *
+ * @var Sabre\DAVACL\PrincipalBackend\BackendInteface
+ */
+ protected $principalBackend;
+
+ /**
+ * CardDAV backend
+ *
+ * @var Backend\BackendInterface
+ */
+ protected $carddavBackend;
+
+ /**
+ * Constructor
+ *
+ * This constructor needs both a principal and a carddav backend.
+ *
+ * By default this class will show a list of addressbook collections for
+ * principals in the 'principals' collection. If your main principals are
+ * actually located in a different path, use the $principalPrefix argument
+ * to override this.
+ *
+ * @param DAVACL\PrincipalBackend\BackendInterface $principalBackend
+ * @param Backend\BackendInterface $carddavBackend
+ * @param string $principalPrefix
+ */
+ public function __construct(DAVACL\PrincipalBackend\BackendInterface $principalBackend, Backend\BackendInterface $carddavBackend, $principalPrefix = 'principals')
+ {
+ $this->carddavBackend = $carddavBackend;
+ parent::__construct($principalBackend, $principalPrefix);
+ }
+
+ /**
+ * Returns the name of the node
+ *
+ * @return string
+ */
+ public function getName()
+ {
+ return \Sabre\CardDAV\Plugin::ADDRESSBOOK_ROOT;
+ }
+
+ /**
+ * This method returns a node for a principal.
+ *
+ * The passed array contains principal information, and is guaranteed to
+ * at least contain a uri item. Other properties may or may not be
+ * supplied by the authentication backend.
+ *
+ * @param array $principal
+ * @return \Sabre\DAV\INode
+ */
+ public function getChildForPrincipal(array $principal)
+ {
+ return new UserAddressBooks($this->carddavBackend, $principal['uri']);
+ }
+
+}