ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilWebDAVRequestHandler.php
Go to the documentation of this file.
1<?php
2
3use function Sabre\HTTP\decodePath;
4use Sabre\DAV\Exception\BadRequest;
5
15{
16 private static $instance;
17
18 public static function getInstance()
19 {
20 return self::$instance ? self::$instance : self::$instance = new ilWebDAVRequestHandler();
21 }
22
28 public function handleRequest()
29 {
30 $this->runWebDAVServer();
31 }
32
38 protected function runWebDAVServer()
39 {
40 $server = new Sabre\DAV\Server($this->getRootDir());
41 $this->setPlugins($server);
42 $server->start();
43 }
44
45
49 protected function setPlugins($server)
50 {
51 global $DIC;
52
53 // Set authentication plugin
54 $webdav_auth = new ilWebDAVAuthentication();
55 $cal = new Sabre\DAV\Auth\Backend\BasicCallBack(array($webdav_auth, 'authenticate'));
56 $plugin = new Sabre\DAV\Auth\Plugin($cal);
57 $server->addPlugin($plugin);
58
59 // Set Lock Plugin
60 $db_manager = new ilWebDAVDBManager($DIC->database());
61 $lock_backend = new ilWebDAVLockBackend($db_manager);
62 $lock_plugin = new Sabre\DAV\Locks\Plugin($lock_backend);
63 $server->addPlugin($lock_plugin);
64
65 /* Set Browser Plugin
66 * This plugin is used to redirect GET-Requests from browsers on collections to the mount instruction page */
67 $browser_plugin = new ilWebDAVSabreBrowserPlugin($DIC->ctrl());
68 $server->addPlugin($browser_plugin);
69 }
70
76 protected function getRootDir()
77 {
78 global $DIC;
79
80 $repo_helper = new ilWebDAVRepositoryHelper($DIC->access(), $DIC->repositoryTree());
81 $dav_helper = new ilWebDAVObjDAVHelper($repo_helper);
82 return new ilMountPointDAV($repo_helper, $dav_helper);
83 }
84}
An exception for terminatinating execution or to throw for unit testing.
Class ilMountPointDAV.
Class ilWebDAVAuthentication.
Class ilWebDAVDBManager.
Class ilWebDAVLockBackend.
Class ilWebDAVObjDAVHelper.
Class ilWebDAVRepositoryHelper.
Class ilWebDAVRequestHandler.
setPlugins($server)
Set server plugins.
getRootDir()
Return the first object to mount on WebDAV.
handleRequest()
For the case there might be more to handle as just running the server.
runWebDAVServer()
Creates and runs SabreDAV Server.
Class ilWebDAVSabreBrowserPlugin.
$server
global $DIC
Definition: goto.php:24