function getACL() { $acl = parent::getACL(); if ($this->getOwner() === 'principals/system/system') { $acl[] = ['privilege' => '{DAV:}read', 'principal' => '{DAV:}authenticated', 'protected' => true]; } return $acl; }
function getACL() { $acl = parent::getACL(); if ($this->getOwner() === 'principals/system/system') { $acl[] = ['privilege' => '{DAV:}read', 'principal' => '{DAV:}authenticated', 'protected' => true]; } /** @var CardDavBackend $carddavBackend */ $carddavBackend = $this->carddavBackend; return $carddavBackend->applyShareAcl($this->getBookId(), $acl); }
/** * Constructor * * @param \Sabre\CardDAV\Backend\BackendInterface $carddavBackend * @param array $addressBookInfo * @param array $cardData */ public function __construct(\Sabre\CardDAV\Backend\BackendInterface $carddavBackend, array $addressBookInfo, array $cardData, $principalUri) { parent::__construct($carddavBackend, $addressBookInfo, $cardData); $this->principalUri = $principalUri; }
/** * Constructor * * @param \Sabre\CardDAV\Backend\AbstractBackend $carddavBackend * @param array $addressBookInfo * @param array $cardData */ public function __construct(\Sabre\CardDAV\Backend\AbstractBackend $carddavBackend, array $addressBookInfo, array $cardData) { $this->addressBookInfo = $addressBookInfo; parent::__construct($carddavBackend, $addressBookInfo, $cardData); }
function getPhoto(Card $node) { // TODO: this is kind of expensive - load carddav data from database and parse it // we might want to build up a cache one day try { $vObject = $this->readCard($node->get()); if (!$vObject->PHOTO) { return false; } $photo = $vObject->PHOTO; $type = $this->getType($photo); $val = $photo->getValue(); if ($photo->getValueType() === 'URI') { $parsed = \Sabre\URI\parse($val); //only allow data:// if ($parsed['scheme'] !== 'data') { return false; } if (substr_count($parsed['path'], ';') === 1) { list($type, ) = explode(';', $parsed['path']); } $val = file_get_contents($val); } return ['Content-Type' => $type, 'body' => $val]; } catch (\Exception $ex) { $this->logger->logException($ex); } return false; }