6 * This object lists a collection of users, which can contain addressbooks.
10 * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
11 * @author Evert Pot (http://www.rooftopsolutions.nl/)
12 * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
14 class Sabre_CardDAV_AddressBookRoot extends Sabre_DAVACL_AbstractPrincipalCollection {
19 * @var Sabre_DAVACL_IPrincipalBackend
21 protected $principalBackend;
26 * @var Sabre_CardDAV_Backend_Abstract
28 protected $carddavBackend;
33 * This constructor needs both a principal and a carddav backend.
35 * By default this class will show a list of addressbook collections for
36 * principals in the 'principals' collection. If your main principals are
37 * actually located in a different path, use the $principalPrefix argument
40 * @param Sabre_DAVACL_IPrincipalBackend $principalBackend
41 * @param Sabre_CardDAV_Backend_Abstract $carddavBackend
42 * @param string $principalPrefix
44 public function __construct(Sabre_DAVACL_IPrincipalBackend $principalBackend,Sabre_CardDAV_Backend_Abstract $carddavBackend, $principalPrefix = 'principals') {
46 $this->carddavBackend = $carddavBackend;
47 parent::__construct($principalBackend, $principalPrefix);
52 * Returns the name of the node
56 public function getName() {
58 return Sabre_CardDAV_Plugin::ADDRESSBOOK_ROOT;
63 * This method returns a node for a principal.
65 * The passed array contains principal information, and is guaranteed to
66 * at least contain a uri item. Other properties may or may not be
67 * supplied by the authentication backend.
69 * @param array $principal
70 * @return Sabre_DAV_INode
72 public function getChildForPrincipal(array $principal) {
74 return new Sabre_CardDAV_UserAddressBooks($this->carddavBackend, $principal['uri']);