aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/CardDAV/Card.php
blob: 8cd4fd7e5ee59a02c42480dafb494ee45c5c1dba (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
34
35
36
37
38
39
40
41
42
<?php

declare(strict_types=1);

/**
 * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-only
 */
namespace OCA\DAV\CardDAV;

class Card extends \Sabre\CardDAV\Card {
	public function getId(): int {
		return (int)$this->cardData['id'];
	}

	public function getUri(): string {
		return $this->cardData['uri'];
	}

	protected function isShared(): bool {
		if (!isset($this->cardData['{http://owncloud.org/ns}owner-principal'])) {
			return false;
		}

		return $this->cardData['{http://owncloud.org/ns}owner-principal'] !== $this->cardData['principaluri'];
	}

	public function getAddressbookId(): int {
		return (int)$this->cardData['addressbookid'];
	}

	public function getPrincipalUri(): string {
		return $this->addressBookInfo['principaluri'];
	}

	public function getOwner(): ?string {
		if (isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) {
			return $this->addressBookInfo['{http://owncloud.org/ns}owner-principal'];
		}
		return parent::getOwner();
	}
}