Card.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCA\DAV\CardDAV;
  8. class Card extends \Sabre\CardDAV\Card {
  9. public function getId(): int {
  10. return (int)$this->cardData['id'];
  11. }
  12. public function getUri(): string {
  13. return $this->cardData['uri'];
  14. }
  15. protected function isShared(): bool {
  16. if (!isset($this->cardData['{http://owncloud.org/ns}owner-principal'])) {
  17. return false;
  18. }
  19. return $this->cardData['{http://owncloud.org/ns}owner-principal'] !== $this->cardData['principaluri'];
  20. }
  21. public function getAddressbookId(): int {
  22. return (int)$this->cardData['addressbookid'];
  23. }
  24. public function getPrincipalUri(): string {
  25. return $this->addressBookInfo['principaluri'];
  26. }
  27. public function getOwner(): ?string {
  28. if (isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) {
  29. return $this->addressBookInfo['{http://owncloud.org/ns}owner-principal'];
  30. }
  31. return parent::getOwner();
  32. }
  33. }