57        return [
'resource-sharing'];
 
   90        $server->xml->elementMap[
'{DAV:}share-resource'] = 
'Sabre\\DAV\\Xml\\Request\\ShareResource';
 
   97        $server->on(
'method:POST',              [$this, 
'httpPost']);
 
   98        $server->on(
'propFind',                 [$this, 
'propFind']);
 
   99        $server->on(
'getSupportedPrivilegeSet', [$this, 
'getSupportedPrivilegeSet']);
 
  100        $server->on(
'onHTMLActionsPanel',       [$this, 
'htmlActionsPanel']);
 
  101        $server->on(
'onBrowserPostAction',      [$this, 
'browserPostAction']);
 
  117        $node = $this->server->tree->getNodeForPath(
$path);
 
  121            throw new Forbidden(
'Sharing is not allowed on this node');
 
  126        $acl = $this->server->getPlugin(
'acl');
 
  130            $acl->checkPrivileges(
$path, 
'{DAV:}share');
 
  133        foreach ($sharees as $sharee) {
 
  137            $this->server->emit(
'getPrincipalByUri', [$sharee->href, &$principal]);
 
  138            $sharee->principal = $principal;
 
  140        $node->updateInvites($sharees);
 
  157            $propFind->
handle(
'{DAV:}share-access', 
function() use ($node) {
 
  159                return new Property\ShareAccess($node->getShareAccess());
 
  162            $propFind->
handle(
'{DAV:}invite', 
function() use ($node) {
 
  164                return new Property\Invite($node->getInvites());
 
  167            $propFind->
handle(
'{DAV:}share-resource-uri', 
function() use ($node) {
 
  169                return new Property\Href($node->getShareResourceUri());
 
  190        if (strpos(
$contentType, 
'application/davsharing+xml') === 
false) {
 
  194        $message = $this->server->xml->parse(
 
  200        switch ($documentType) {
 
  202            case '{DAV:}share-resource':
 
  208                $response->setHeader(
'X-Sabre-Status', 
'everything-went-well');
 
  214                throw new BadRequest(
'Unexpected document type: ' . $documentType . 
' for this Content-Type');
 
  232            $supportedPrivilegeSet[
'{DAV:}share'] = [
 
  254            'description' => 
'This plugin implements WebDAV resource sharing',
 
  255            'link'        => 
'https://github.com/evert/webdav-sharing' 
  277            if (!
$aclPlugin->checkPrivileges(
$path, 
'{DAV:}share', \
Sabre\DAVACL\Plugin::R_PARENT, 
false)) {
 
  283        $output .= 
'<tr><td colspan="2"><form method="post" action=""> 
  284            <h3>Share this resource</h3> 
  285            <input type="hidden" name="sabreAction" value="share" /> 
  286            <label>Share with (uri):</label> <input type="text" name="href" placeholder="mailto:user@example.org"/><br /> 
  287            <label>Access</label> 
  288                <select name="access"> 
  289                    <option value="readwrite">Read-write</option> 
  290                    <option value="read">Read-only</option> 
  291                    <option value="no-access">Revoke access</option> 
  293             <input type="submit" value="share" /> 
  313        if (empty($postVars[
'href'])) {
 
  314            throw new BadRequest(
'The "href" POST parameter is required');
 
  316        if (empty($postVars[
'access'])) {
 
  317            throw new BadRequest(
'The "access" POST parameter is required');
 
  326        if (!isset($accessMap[$postVars[
'access']])) {
 
  327            throw new BadRequest(
'The "access" POST must be readwrite, read or no-access');
 
  330            'href'   => $postVars[
'href'],
 
  331            'access' => $accessMap[$postVars[
'access']],
 
foreach($paths as $path) $request
An exception for terminatinating execution or to throw for unit testing.
This class holds all the information about a PROPFIND request.
handle($propertyName, $valueOrCallBack)
Handles a specific property.
The baseclass for all server plugins.
This plugin implements HTTP requests and properties related to:
browserPostAction($path, $action, $postVars)
This method is triggered for POST actions generated by the browser plugin.
getPluginInfo()
Returns a bunch of meta-data about the plugin.
getPluginName()
Returns a plugin name.
htmlActionsPanel(INode $node, &$output, $path)
This method is used to generate HTML output for the DAV\Browser\Plugin.
httpPost(RequestInterface $request, ResponseInterface $response)
We intercept this to handle POST requests on shared resources.
propFind(PropFind $propFind, INode $node)
This event is triggered when properties are requested for nodes.
getSupportedPrivilegeSet(INode $node, array &$supportedPrivilegeSet)
This method is triggered whenever a subsystem reqeuests the privileges hat are supported on a particu...
getFeatures()
This method should return a list of server-features.
initialize(Server $server)
This initializes the plugin.
shareResource($path, array $sharees)
Updates the list of sharees on a shared resource.
This class represents the {DAV:}sharee element.
The INode interface is the base interface, and the parent class of both ICollection and IFile.
This interface represents a resource that has sharing capabilities, either because it's possible for ...
The RequestInterface represents a HTTP request.
This interface represents a HTTP response.
setStatus($status)
Sets the HTTP status code.
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