45 return [
'calendarserver-sharing'];
59 return 'caldav-sharing';
78 if (is_null($this->server->getPlugin(
'sharing'))) {
79 throw new \LogicException(
'The generic "sharing" plugin must be loaded before the caldav sharing plugin. Call $server->addPlugin(new \Sabre\DAV\Sharing\Plugin()); before this one.');
83 $this->server->protectedProperties,
90 $this->server->xml->elementMap[
'{' .
Plugin::NS_CALENDARSERVER .
'}invite-reply'] =
'Sabre\\CalDAV\\Xml\\Request\\InviteReply';
92 $this->server->on(
'propFind', [$this,
'propFindEarly']);
93 $this->server->on(
'propFind', [$this,
'propFindLate'], 150);
94 $this->server->on(
'propPatch', [$this,
'propPatch'], 40);
95 $this->server->on(
'method:POST', [$this,
'httpPost']);
116 $props = $this->server->getPropertiesForPath($node->getOwner(), [
117 '{http://sabredav.org/ns}email-address',
122 'href' => $node->getOwner(),
125 if (isset($props[0][200])) {
129 if (isset($props[0][200][
'{http://sabredav.org/ns}email-address'])) {
130 $ownerInfo[
'href'] =
'mailto:' . $props[0][200][
'{http://sabredav.org/ns}email-address'];
132 if (isset($props[0][200][
'{DAV:}displayname'])) {
133 $ownerInfo[
'commonName'] = $props[0][200][
'{DAV:}displayname'];
161 $shareAccess = $node->getShareAccess();
162 if ($rt = $propFind->get(
'{DAV:}resourcetype')) {
163 switch ($shareAccess) {
164 case \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER :
167 case \Sabre\DAV\Sharing\Plugin::ACCESS_READ :
168 case \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE :
199 $node = $this->server->tree->getNodeForPath(
$path);
203 if ($node->getShareAccess() === \
Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER || $node->getShareAccess() === \
Sabre\DAV\Sharing\Plugin::ACCESS_NOTSHARED) {
205 $propPatch->handle(
'{DAV:}resourcetype',
function($value) use ($node) {
207 $shares = $node->getInvites();
211 $node->updateInvites($shares);
239 $node = $this->server->tree->getNodeForPath(
$path);
244 $requestBody =
$request->getBodyAsString();
255 $message = $this->server->xml->parse($requestBody,
$request->getUrl(), $documentType);
257 switch ($documentType) {
263 $sharingPlugin = $this->server->getPlugin(
'sharing');
269 $response->setHeader(
'X-Sabre-Status',
'everything-went-well');
282 $this->server->transactionType =
'post-invite-reply';
285 $acl = $this->server->getPlugin(
'acl');
289 $acl->checkPrivileges(
$path,
'{DAV:}write');
292 $url = $node->shareReply(
303 $response->setHeader(
'X-Sabre-Status',
'everything-went-well');
306 $writer = $this->server->xml->getWriter();
307 $writer->openMemory();
308 $writer->startDocument();
311 $writer->endElement();
312 $response->setHeader(
'Content-Type',
'application/xml');
313 $response->setBody($writer->outputMemory());
326 $this->server->transactionType =
'post-publish-calendar';
329 $acl = $this->server->getPlugin(
'acl');
333 $acl->checkPrivileges(
$path,
'{DAV:}share');
336 $node->setPublishStatus(
true);
343 $response->setHeader(
'X-Sabre-Status',
'everything-went-well');
354 $this->server->transactionType =
'post-unpublish-calendar';
357 $acl = $this->server->getPlugin(
'acl');
361 $acl->checkPrivileges(
$path,
'{DAV:}share');
364 $node->setPublishStatus(
false);
370 $response->setHeader(
'X-Sabre-Status',
'everything-went-well');
396 'description' =>
'Adds support for caldav-sharing.',
397 'link' =>
'http://sabre.io/dav/caldav-sharing/',
foreach($paths as $path) $request
An exception for terminatinating execution or to throw for unit testing.
The CalendarHome represents a node that is usually in a users' calendar-homeset.
const NS_CALENDARSERVER
This is the namespace for the proprietary calendarserver extensions.
This plugin implements support for caldav sharing.
propFindEarly(DAV\PropFind $propFind, DAV\INode $node)
This event is triggered when properties are requested for a certain node.
propFindLate(DAV\PropFind $propFind, DAV\INode $node)
This method is triggered after all properties have been retrieved.
propPatch($path, DAV\PropPatch $propPatch)
This method is trigged when a user attempts to update a node's properties.
httpPost(RequestInterface $request, ResponseInterface $response)
We intercept this to handle POST requests on calendars.
getFeatures()
This method should return a list of server-features.
initialize(DAV\Server $server)
This initializes the plugin.
getPluginInfo()
Returns a bunch of meta-data about the plugin.
getPluginName()
Returns a plugin name.
This class holds all the information about a PROPFIND request.
This class represents a set of properties that are going to be updated.
The baseclass for all server plugins.
if(!file_exists(getcwd() . '/ilias.ini.php'))
registration confirmation script for ilias
This interface represents a Calendar that is shared by a different user.
The INode interface is the base interface, and the parent class of both ICollection and IFile.
The RequestInterface represents a HTTP request.
This interface represents a HTTP response.
catch(Exception $e) $message
if( $path[strlen( $path) - 1]==='/') if(is_dir($path)) if(!file_exists( $path)) if(preg_match('#\.php$#D', mb_strtolower($path, 'UTF-8'))) $contentType
foreach( $values as $value)