Пример #1
0
 function getACL()
 {
     $acl = parent::getACL();
     if ($this->getOwner() === 'principals/system/system') {
         $acl[] = ['privilege' => '{DAV:}read', 'principal' => '{DAV:}authenticated', 'protected' => true];
     }
     return $acl;
 }
Пример #2
0
 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);
 }
Пример #3
0
 /**
  * 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;
 }
Пример #4
0
 /**
  * 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);
 }
Пример #5
0
 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;
 }