Beispiel #1
0
 /**
  * This event is triggered when properties are requested for nodes.
  *
  * This allows us to inject any sharings-specific properties.
  *
  * @param PropFind $propFind
  * @param INode $node
  * @return void
  */
 function propFind(PropFind $propFind, INode $node)
 {
     if ($node instanceof ISharedNode) {
         $propFind->handle('{DAV:}share-access', function () use($node) {
             return new Property\ShareAccess($node->getShareAccess());
         });
         $propFind->handle('{DAV:}invite', function () use($node) {
             return new Property\Invite($node->getInvites());
         });
         $propFind->handle('{DAV:}share-resource-uri', function () use($node) {
             return new Property\Href($node->getShareResourceUri());
         });
     }
 }
Beispiel #2
0
 /**
  * This method is triggered *after* all properties have been retrieved.
  * This allows us to inject the correct resourcetype for calendars that
  * have been shared.
  *
  * @param DAV\PropFind $propFind
  * @param DAV\INode $node
  * @return void
  */
 function propFindLate(DAV\PropFind $propFind, DAV\INode $node)
 {
     if ($node instanceof ISharedCalendar) {
         $shareAccess = $node->getShareAccess();
         if ($rt = $propFind->get('{DAV:}resourcetype')) {
             switch ($shareAccess) {
                 case \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER:
                     $rt->add('{' . Plugin::NS_CALENDARSERVER . '}shared-owner');
                     break;
                 case \Sabre\DAV\Sharing\Plugin::ACCESS_READ:
                 case \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE:
                     $rt->add('{' . Plugin::NS_CALENDARSERVER . '}shared');
                     break;
             }
         }
         $propFind->handle('{' . Plugin::NS_CALENDARSERVER . '}allowed-sharing-modes', function () {
             return new Xml\Property\AllowedSharingModes(true, false);
         });
     }
 }