ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilWebDAVDIC.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use Pimple\Container;
22use ILIAS\DI\Container as ILIASContainer;
23use Sabre\DAV\Auth\Plugin as AuthPlugin;
24use Sabre\DAV\Locks\Plugin as LocksPlugin;
25use Sabre\DAV\Browser\Plugin as BrowserPlugin;
26use Sabre\DAV\Auth\Backend\BasicCallBack;
27
28class ilWebDAVDIC extends Container
29{
30 public function initWithoutDIC(): void
31 {
32 global $DIC;
33 $this->init($DIC);
34 }
35
36 public function init(ILIASContainer $DIC): void
37 {
38 $this['dav_settings'] = fn($c): ilSetting => new ilSetting('webdav');
39
40 $this['locks.repository'] = fn($c): ilWebDAVLocksRepository => new ilWebDAVLocksRepository($DIC->database());
41
42 $this['repository.helper'] = fn($c): ilWebDAVRepositoryHelper => new ilWebDAVRepositoryHelper(
43 $DIC->access(),
44 $DIC->repositoryTree(),
45 new ilRepUtil(),
46 $c['locks.repository'],
48 );
49
50 $this['uriresolver'] = fn($c): ilWebDAVLockUriPathResolver => new ilWebDAVLockUriPathResolver(
51 $c['repository.helper']
52 );
53
54 $this['davobj.factory'] = fn($c): ilWebDAVObjFactory => new ilWebDAVObjFactory(
55 $c['repository.helper'],
56 $DIC->user(),
57 $DIC->resourceStorage(),
58 $DIC->http()->request(),
59 $DIC->language(),
60 $DIC['ilias']->getClientId(),
61 (bool) $c['dav_settings']->get('webdav_versioning_enabled', 'true')
62 );
63
64 $this['locks.backend'] = fn($c): ilWebDAVLocksBackend => new ilWebDAVLocksBackend(
65 $c['locks.repository'],
66 $c['repository.helper'],
67 $c['davobj.factory'],
68 $c['uriresolver'],
69 $DIC->user()
70 );
71
72 $this['mountinstructions.repository'] = fn(
73 $c
75
76 $this['mountinstructions.facory'] = fn(
77 $c
79 $c['mountinstructions.repository'],
80 $DIC->http()->request(),
81 $DIC->user()
82 );
83
84 $this['mountinstructions.gui'] = fn($c): ilWebDAVMountInstructionsGUI => new ilWebDAVMountInstructionsGUI(
85 $c['mountinstructions.facory']->getMountInstructionsObject(),
86 $DIC->language(),
87 $DIC->ui(),
88 $DIC->http()
89 );
90
91 $this['mountinstructions.uploadgui'] = fn(
92 $c
94 $DIC->ui()->mainTemplate(),
95 $DIC->user(),
96 $DIC->ctrl(),
97 $DIC->language(),
98 $DIC->rbac()->system(),
99 $DIC["ilErr"],
101 $DIC->toolbar(),
102 $DIC->http(),
103 $DIC->refinery(),
104 $DIC->ui(),
105 $DIC->filesystem(),
106 $DIC->upload(),
107 $c['mountinstructions.repository']
108 );
109
110 $this['sabre.authplugin'] = function ($c) use ($DIC): AuthPlugin {
111 $webdav_auth = new ilWebDAVAuthentication(
112 $DIC->user(),
113 $DIC['ilAuthSession'],
115 );
116 $auth_callback_class = new BasicCallBack(
117 fn($username, $password): bool => $webdav_auth->authenticate($username, $password)
118 );
119
120 return new AuthPlugin($auth_callback_class);
121 };
122
123 $this['sabre.locksplugin'] = fn($c): LocksPlugin => new LocksPlugin($c['locks.backend']);
124
125 $this['sabre.browserplugin'] = fn($c): ilWebDAVSabreBrowserPlugin => new ilWebDAVSabreBrowserPlugin(
126 $DIC->ctrl(),
127 $DIC->http()->request()->getUri()
128 );
129 }
130
131 public function dav_settings(): ilSetting
132 {
133 return $this['dav_settings'];
134 }
135
137 {
138 return $this['davobj.factory'];
139 }
140
142 {
143 return $this['mountinstructions.gui'];
144 }
145
147 {
148 return $this['mountinstructions.uploadgui'];
149 }
150
151 public function authplugin(): AuthPlugin
152 {
153 return $this['sabre.authplugin'];
154 }
155
157 {
158 return $this['locks.backend'];
159 }
160
161 public function locksplugin(): LocksPlugin
162 {
163 return $this['sabre.locksplugin'];
164 }
165
166 public function browserplugin(): BrowserPlugin
167 {
168 return $this['sabre.browserplugin'];
169 }
170}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
static getLogger(string $a_component_id)
Get component logger.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Setting Class.
init(ILIASContainer $DIC)
The only purpose for this class is to redirect a browsers WebDAV-Request to the mount-instructions pa...
$c
Definition: deliver.php:25
global $DIC
Definition: shib_login.php:26