summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/carddav/addressbookroot.php
blob: 8c78d0245562dcec37302ea693da711449207dbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php

namespace OCA\DAV\CardDAV;

class AddressBookRoot extends \Sabre\CardDAV\AddressBookRoot {

	/**
	 * 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
	 */
	function getChildForPrincipal(array $principal) {

		return new UserAddressBooks($this->carddavBackend, $principal['uri']);

	}

	function getName() {

		// Grabbing all the components of the principal path.
		$parts = explode('/', $this->principalPrefix);

		// We are only interested in the second part.
		return $parts[1];

	}

}