@@ -38,102 +38,102 @@ |
||
38 | 38 | * @package OCA\DAV\CalDAV\BirthdayCalendar |
39 | 39 | */ |
40 | 40 | class EnablePlugin extends ServerPlugin { |
41 | - const NS_Nextcloud = 'http://nextcloud.com/ns'; |
|
42 | - |
|
43 | - /** |
|
44 | - * @var IConfig |
|
45 | - */ |
|
46 | - protected $config; |
|
47 | - |
|
48 | - /** |
|
49 | - * @var BirthdayService |
|
50 | - */ |
|
51 | - protected $birthdayService; |
|
52 | - |
|
53 | - /** |
|
54 | - * @var Server |
|
55 | - */ |
|
56 | - protected $server; |
|
57 | - |
|
58 | - /** |
|
59 | - * PublishPlugin constructor. |
|
60 | - * |
|
61 | - * @param IConfig $config |
|
62 | - * @param BirthdayService $birthdayService |
|
63 | - */ |
|
64 | - public function __construct(IConfig $config, BirthdayService $birthdayService) { |
|
65 | - $this->config = $config; |
|
66 | - $this->birthdayService = $birthdayService; |
|
67 | - } |
|
68 | - |
|
69 | - /** |
|
70 | - * This method should return a list of server-features. |
|
71 | - * |
|
72 | - * This is for example 'versioning' and is added to the DAV: header |
|
73 | - * in an OPTIONS response. |
|
74 | - * |
|
75 | - * @return string[] |
|
76 | - */ |
|
77 | - public function getFeatures() { |
|
78 | - return ['nc-enable-birthday-calendar']; |
|
79 | - } |
|
80 | - |
|
81 | - /** |
|
82 | - * Returns a plugin name. |
|
83 | - * |
|
84 | - * Using this name other plugins will be able to access other plugins |
|
85 | - * using Sabre\DAV\Server::getPlugin |
|
86 | - * |
|
87 | - * @return string |
|
88 | - */ |
|
89 | - public function getPluginName() { |
|
90 | - return 'nc-enable-birthday-calendar'; |
|
91 | - } |
|
92 | - |
|
93 | - /** |
|
94 | - * This initializes the plugin. |
|
95 | - * |
|
96 | - * This function is called by Sabre\DAV\Server, after |
|
97 | - * addPlugin is called. |
|
98 | - * |
|
99 | - * This method should set up the required event subscriptions. |
|
100 | - * |
|
101 | - * @param Server $server |
|
102 | - */ |
|
103 | - public function initialize(Server $server) { |
|
104 | - $this->server = $server; |
|
105 | - |
|
106 | - $this->server->on('method:POST', [$this, 'httpPost']); |
|
107 | - } |
|
108 | - |
|
109 | - /** |
|
110 | - * We intercept this to handle POST requests on calendar homes. |
|
111 | - * |
|
112 | - * @param RequestInterface $request |
|
113 | - * @param ResponseInterface $response |
|
114 | - * |
|
115 | - * @return bool|void |
|
116 | - */ |
|
117 | - public function httpPost(RequestInterface $request, ResponseInterface $response) { |
|
118 | - $node = $this->server->tree->getNodeForPath($this->server->getRequestUri()); |
|
119 | - if (!($node instanceof CalendarHome)) { |
|
120 | - return; |
|
121 | - } |
|
122 | - |
|
123 | - $requestBody = $request->getBodyAsString(); |
|
124 | - $this->server->xml->parse($requestBody, $request->getUrl(), $documentType); |
|
125 | - if ($documentType !== '{'.self::NS_Nextcloud.'}enable-birthday-calendar') { |
|
126 | - return; |
|
127 | - } |
|
128 | - |
|
129 | - $principalUri = $node->getOwner(); |
|
130 | - $userId = substr($principalUri, 17); |
|
131 | - |
|
132 | - $this->config->setUserValue($userId, 'dav', 'generateBirthdayCalendar', 'yes'); |
|
133 | - $this->birthdayService->syncUser($userId); |
|
134 | - |
|
135 | - $this->server->httpResponse->setStatus(204); |
|
136 | - |
|
137 | - return false; |
|
138 | - } |
|
41 | + const NS_Nextcloud = 'http://nextcloud.com/ns'; |
|
42 | + |
|
43 | + /** |
|
44 | + * @var IConfig |
|
45 | + */ |
|
46 | + protected $config; |
|
47 | + |
|
48 | + /** |
|
49 | + * @var BirthdayService |
|
50 | + */ |
|
51 | + protected $birthdayService; |
|
52 | + |
|
53 | + /** |
|
54 | + * @var Server |
|
55 | + */ |
|
56 | + protected $server; |
|
57 | + |
|
58 | + /** |
|
59 | + * PublishPlugin constructor. |
|
60 | + * |
|
61 | + * @param IConfig $config |
|
62 | + * @param BirthdayService $birthdayService |
|
63 | + */ |
|
64 | + public function __construct(IConfig $config, BirthdayService $birthdayService) { |
|
65 | + $this->config = $config; |
|
66 | + $this->birthdayService = $birthdayService; |
|
67 | + } |
|
68 | + |
|
69 | + /** |
|
70 | + * This method should return a list of server-features. |
|
71 | + * |
|
72 | + * This is for example 'versioning' and is added to the DAV: header |
|
73 | + * in an OPTIONS response. |
|
74 | + * |
|
75 | + * @return string[] |
|
76 | + */ |
|
77 | + public function getFeatures() { |
|
78 | + return ['nc-enable-birthday-calendar']; |
|
79 | + } |
|
80 | + |
|
81 | + /** |
|
82 | + * Returns a plugin name. |
|
83 | + * |
|
84 | + * Using this name other plugins will be able to access other plugins |
|
85 | + * using Sabre\DAV\Server::getPlugin |
|
86 | + * |
|
87 | + * @return string |
|
88 | + */ |
|
89 | + public function getPluginName() { |
|
90 | + return 'nc-enable-birthday-calendar'; |
|
91 | + } |
|
92 | + |
|
93 | + /** |
|
94 | + * This initializes the plugin. |
|
95 | + * |
|
96 | + * This function is called by Sabre\DAV\Server, after |
|
97 | + * addPlugin is called. |
|
98 | + * |
|
99 | + * This method should set up the required event subscriptions. |
|
100 | + * |
|
101 | + * @param Server $server |
|
102 | + */ |
|
103 | + public function initialize(Server $server) { |
|
104 | + $this->server = $server; |
|
105 | + |
|
106 | + $this->server->on('method:POST', [$this, 'httpPost']); |
|
107 | + } |
|
108 | + |
|
109 | + /** |
|
110 | + * We intercept this to handle POST requests on calendar homes. |
|
111 | + * |
|
112 | + * @param RequestInterface $request |
|
113 | + * @param ResponseInterface $response |
|
114 | + * |
|
115 | + * @return bool|void |
|
116 | + */ |
|
117 | + public function httpPost(RequestInterface $request, ResponseInterface $response) { |
|
118 | + $node = $this->server->tree->getNodeForPath($this->server->getRequestUri()); |
|
119 | + if (!($node instanceof CalendarHome)) { |
|
120 | + return; |
|
121 | + } |
|
122 | + |
|
123 | + $requestBody = $request->getBodyAsString(); |
|
124 | + $this->server->xml->parse($requestBody, $request->getUrl(), $documentType); |
|
125 | + if ($documentType !== '{'.self::NS_Nextcloud.'}enable-birthday-calendar') { |
|
126 | + return; |
|
127 | + } |
|
128 | + |
|
129 | + $principalUri = $node->getOwner(); |
|
130 | + $userId = substr($principalUri, 17); |
|
131 | + |
|
132 | + $this->config->setUserValue($userId, 'dav', 'generateBirthdayCalendar', 'yes'); |
|
133 | + $this->birthdayService->syncUser($userId); |
|
134 | + |
|
135 | + $this->server->httpResponse->setStatus(204); |
|
136 | + |
|
137 | + return false; |
|
138 | + } |
|
139 | 139 | } |
@@ -65,222 +65,222 @@ |
||
65 | 65 | |
66 | 66 | class Server { |
67 | 67 | |
68 | - /** @var IRequest */ |
|
69 | - private $request; |
|
68 | + /** @var IRequest */ |
|
69 | + private $request; |
|
70 | 70 | |
71 | - /** @var string */ |
|
72 | - private $baseUri; |
|
71 | + /** @var string */ |
|
72 | + private $baseUri; |
|
73 | 73 | |
74 | - /** @var Connector\Sabre\Server */ |
|
75 | - private $server; |
|
74 | + /** @var Connector\Sabre\Server */ |
|
75 | + private $server; |
|
76 | 76 | |
77 | - public function __construct(IRequest $request, $baseUri) { |
|
78 | - $this->request = $request; |
|
79 | - $this->baseUri = $baseUri; |
|
80 | - $logger = \OC::$server->getLogger(); |
|
81 | - $mailer = \OC::$server->getMailer(); |
|
82 | - $dispatcher = \OC::$server->getEventDispatcher(); |
|
83 | - $timezone = new TimeFactory(); |
|
84 | - $sendInvitations = \OC::$server->getConfig()->getAppValue('dav', 'sendInvitations', 'yes') === 'yes'; |
|
85 | - $l10nFactory = \OC::$server->getL10NFactory(); |
|
77 | + public function __construct(IRequest $request, $baseUri) { |
|
78 | + $this->request = $request; |
|
79 | + $this->baseUri = $baseUri; |
|
80 | + $logger = \OC::$server->getLogger(); |
|
81 | + $mailer = \OC::$server->getMailer(); |
|
82 | + $dispatcher = \OC::$server->getEventDispatcher(); |
|
83 | + $timezone = new TimeFactory(); |
|
84 | + $sendInvitations = \OC::$server->getConfig()->getAppValue('dav', 'sendInvitations', 'yes') === 'yes'; |
|
85 | + $l10nFactory = \OC::$server->getL10NFactory(); |
|
86 | 86 | |
87 | - $root = new RootCollection(); |
|
88 | - $this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root)); |
|
87 | + $root = new RootCollection(); |
|
88 | + $this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root)); |
|
89 | 89 | |
90 | - // Add maintenance plugin |
|
91 | - $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin(\OC::$server->getConfig())); |
|
90 | + // Add maintenance plugin |
|
91 | + $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin(\OC::$server->getConfig())); |
|
92 | 92 | |
93 | - // Backends |
|
94 | - $authBackend = new Auth( |
|
95 | - \OC::$server->getSession(), |
|
96 | - \OC::$server->getUserSession(), |
|
97 | - \OC::$server->getRequest(), |
|
98 | - \OC::$server->getTwoFactorAuthManager(), |
|
99 | - \OC::$server->getBruteForceThrottler() |
|
100 | - ); |
|
93 | + // Backends |
|
94 | + $authBackend = new Auth( |
|
95 | + \OC::$server->getSession(), |
|
96 | + \OC::$server->getUserSession(), |
|
97 | + \OC::$server->getRequest(), |
|
98 | + \OC::$server->getTwoFactorAuthManager(), |
|
99 | + \OC::$server->getBruteForceThrottler() |
|
100 | + ); |
|
101 | 101 | |
102 | - // Set URL explicitly due to reverse-proxy situations |
|
103 | - $this->server->httpRequest->setUrl($this->request->getRequestUri()); |
|
104 | - $this->server->setBaseUri($this->baseUri); |
|
102 | + // Set URL explicitly due to reverse-proxy situations |
|
103 | + $this->server->httpRequest->setUrl($this->request->getRequestUri()); |
|
104 | + $this->server->setBaseUri($this->baseUri); |
|
105 | 105 | |
106 | - $this->server->addPlugin(new BlockLegacyClientPlugin(\OC::$server->getConfig())); |
|
107 | - $authPlugin = new Plugin(); |
|
108 | - $authPlugin->addBackend(new PublicAuth()); |
|
109 | - $this->server->addPlugin($authPlugin); |
|
106 | + $this->server->addPlugin(new BlockLegacyClientPlugin(\OC::$server->getConfig())); |
|
107 | + $authPlugin = new Plugin(); |
|
108 | + $authPlugin->addBackend(new PublicAuth()); |
|
109 | + $this->server->addPlugin($authPlugin); |
|
110 | 110 | |
111 | - // allow setup of additional auth backends |
|
112 | - $event = new SabrePluginEvent($this->server); |
|
113 | - $dispatcher->dispatch('OCA\DAV\Connector\Sabre::authInit', $event); |
|
111 | + // allow setup of additional auth backends |
|
112 | + $event = new SabrePluginEvent($this->server); |
|
113 | + $dispatcher->dispatch('OCA\DAV\Connector\Sabre::authInit', $event); |
|
114 | 114 | |
115 | - $bearerAuthBackend = new BearerAuth( |
|
116 | - \OC::$server->getUserSession(), |
|
117 | - \OC::$server->getSession(), |
|
118 | - \OC::$server->getRequest() |
|
119 | - ); |
|
120 | - $authPlugin->addBackend($bearerAuthBackend); |
|
121 | - // because we are throwing exceptions this plugin has to be the last one |
|
122 | - $authPlugin->addBackend($authBackend); |
|
115 | + $bearerAuthBackend = new BearerAuth( |
|
116 | + \OC::$server->getUserSession(), |
|
117 | + \OC::$server->getSession(), |
|
118 | + \OC::$server->getRequest() |
|
119 | + ); |
|
120 | + $authPlugin->addBackend($bearerAuthBackend); |
|
121 | + // because we are throwing exceptions this plugin has to be the last one |
|
122 | + $authPlugin->addBackend($authBackend); |
|
123 | 123 | |
124 | - // debugging |
|
125 | - if(\OC::$server->getConfig()->getSystemValue('debug', false)) { |
|
126 | - $this->server->addPlugin(new \Sabre\DAV\Browser\Plugin()); |
|
127 | - } else { |
|
128 | - $this->server->addPlugin(new DummyGetResponsePlugin()); |
|
129 | - } |
|
124 | + // debugging |
|
125 | + if(\OC::$server->getConfig()->getSystemValue('debug', false)) { |
|
126 | + $this->server->addPlugin(new \Sabre\DAV\Browser\Plugin()); |
|
127 | + } else { |
|
128 | + $this->server->addPlugin(new DummyGetResponsePlugin()); |
|
129 | + } |
|
130 | 130 | |
131 | - $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $logger)); |
|
132 | - $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin()); |
|
133 | - $this->server->addPlugin(new \Sabre\DAV\Sync\Plugin()); |
|
131 | + $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $logger)); |
|
132 | + $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin()); |
|
133 | + $this->server->addPlugin(new \Sabre\DAV\Sync\Plugin()); |
|
134 | 134 | |
135 | - // acl |
|
136 | - $acl = new DavAclPlugin(); |
|
137 | - $acl->principalCollectionSet = [ |
|
138 | - 'principals/users', 'principals/groups' |
|
139 | - ]; |
|
140 | - $acl->defaultUsernamePath = 'principals/users'; |
|
141 | - $this->server->addPlugin($acl); |
|
135 | + // acl |
|
136 | + $acl = new DavAclPlugin(); |
|
137 | + $acl->principalCollectionSet = [ |
|
138 | + 'principals/users', 'principals/groups' |
|
139 | + ]; |
|
140 | + $acl->defaultUsernamePath = 'principals/users'; |
|
141 | + $this->server->addPlugin($acl); |
|
142 | 142 | |
143 | - // calendar plugins |
|
144 | - $this->server->addPlugin(new \OCA\DAV\CalDAV\Plugin()); |
|
145 | - $this->server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin()); |
|
146 | - $this->server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin()); |
|
147 | - if ($sendInvitations) { |
|
148 | - $this->server->addPlugin(\OC::$server->query(\OCA\DAV\CalDAV\Schedule\IMipPlugin::class)); |
|
149 | - } |
|
150 | - $this->server->addPlugin(new \Sabre\CalDAV\Subscriptions\Plugin()); |
|
151 | - $this->server->addPlugin(new \Sabre\CalDAV\Notifications\Plugin()); |
|
152 | - $this->server->addPlugin(new DAV\Sharing\Plugin($authBackend, \OC::$server->getRequest())); |
|
153 | - $this->server->addPlugin(new \OCA\DAV\CalDAV\Publishing\PublishPlugin( |
|
154 | - \OC::$server->getConfig(), |
|
155 | - \OC::$server->getURLGenerator() |
|
156 | - )); |
|
143 | + // calendar plugins |
|
144 | + $this->server->addPlugin(new \OCA\DAV\CalDAV\Plugin()); |
|
145 | + $this->server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin()); |
|
146 | + $this->server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin()); |
|
147 | + if ($sendInvitations) { |
|
148 | + $this->server->addPlugin(\OC::$server->query(\OCA\DAV\CalDAV\Schedule\IMipPlugin::class)); |
|
149 | + } |
|
150 | + $this->server->addPlugin(new \Sabre\CalDAV\Subscriptions\Plugin()); |
|
151 | + $this->server->addPlugin(new \Sabre\CalDAV\Notifications\Plugin()); |
|
152 | + $this->server->addPlugin(new DAV\Sharing\Plugin($authBackend, \OC::$server->getRequest())); |
|
153 | + $this->server->addPlugin(new \OCA\DAV\CalDAV\Publishing\PublishPlugin( |
|
154 | + \OC::$server->getConfig(), |
|
155 | + \OC::$server->getURLGenerator() |
|
156 | + )); |
|
157 | 157 | |
158 | - // addressbook plugins |
|
159 | - $this->server->addPlugin(new \OCA\DAV\CardDAV\Plugin()); |
|
160 | - $this->server->addPlugin(new VCFExportPlugin()); |
|
161 | - $this->server->addPlugin(new ImageExportPlugin(new PhotoCache(\OC::$server->getAppDataDir('dav-photocache')))); |
|
158 | + // addressbook plugins |
|
159 | + $this->server->addPlugin(new \OCA\DAV\CardDAV\Plugin()); |
|
160 | + $this->server->addPlugin(new VCFExportPlugin()); |
|
161 | + $this->server->addPlugin(new ImageExportPlugin(new PhotoCache(\OC::$server->getAppDataDir('dav-photocache')))); |
|
162 | 162 | |
163 | - // system tags plugins |
|
164 | - $this->server->addPlugin(new SystemTagPlugin( |
|
165 | - \OC::$server->getSystemTagManager(), |
|
166 | - \OC::$server->getGroupManager(), |
|
167 | - \OC::$server->getUserSession() |
|
168 | - )); |
|
163 | + // system tags plugins |
|
164 | + $this->server->addPlugin(new SystemTagPlugin( |
|
165 | + \OC::$server->getSystemTagManager(), |
|
166 | + \OC::$server->getGroupManager(), |
|
167 | + \OC::$server->getUserSession() |
|
168 | + )); |
|
169 | 169 | |
170 | - // comments plugin |
|
171 | - $this->server->addPlugin(new CommentsPlugin( |
|
172 | - \OC::$server->getCommentsManager(), |
|
173 | - \OC::$server->getUserSession() |
|
174 | - )); |
|
170 | + // comments plugin |
|
171 | + $this->server->addPlugin(new CommentsPlugin( |
|
172 | + \OC::$server->getCommentsManager(), |
|
173 | + \OC::$server->getUserSession() |
|
174 | + )); |
|
175 | 175 | |
176 | - $this->server->addPlugin(new CopyEtagHeaderPlugin()); |
|
176 | + $this->server->addPlugin(new CopyEtagHeaderPlugin()); |
|
177 | 177 | |
178 | - // allow setup of additional plugins |
|
179 | - $dispatcher->dispatch('OCA\DAV\Connector\Sabre::addPlugin', $event); |
|
178 | + // allow setup of additional plugins |
|
179 | + $dispatcher->dispatch('OCA\DAV\Connector\Sabre::addPlugin', $event); |
|
180 | 180 | |
181 | - // Some WebDAV clients do require Class 2 WebDAV support (locking), since |
|
182 | - // we do not provide locking we emulate it using a fake locking plugin. |
|
183 | - if($request->isUserAgent([ |
|
184 | - '/WebDAVFS/', |
|
185 | - '/Microsoft Office OneNote 2013/', |
|
186 | - '/^Microsoft-WebDAV/',// Microsoft-WebDAV-MiniRedir/6.1.7601 |
|
187 | - ])) { |
|
188 | - $this->server->addPlugin(new FakeLockerPlugin()); |
|
189 | - } |
|
181 | + // Some WebDAV clients do require Class 2 WebDAV support (locking), since |
|
182 | + // we do not provide locking we emulate it using a fake locking plugin. |
|
183 | + if($request->isUserAgent([ |
|
184 | + '/WebDAVFS/', |
|
185 | + '/Microsoft Office OneNote 2013/', |
|
186 | + '/^Microsoft-WebDAV/',// Microsoft-WebDAV-MiniRedir/6.1.7601 |
|
187 | + ])) { |
|
188 | + $this->server->addPlugin(new FakeLockerPlugin()); |
|
189 | + } |
|
190 | 190 | |
191 | - if (BrowserErrorPagePlugin::isBrowserRequest($request)) { |
|
192 | - $this->server->addPlugin(new BrowserErrorPagePlugin()); |
|
193 | - } |
|
191 | + if (BrowserErrorPagePlugin::isBrowserRequest($request)) { |
|
192 | + $this->server->addPlugin(new BrowserErrorPagePlugin()); |
|
193 | + } |
|
194 | 194 | |
195 | - // wait with registering these until auth is handled and the filesystem is setup |
|
196 | - $this->server->on('beforeMethod', function () use ($root) { |
|
197 | - // custom properties plugin must be the last one |
|
198 | - $userSession = \OC::$server->getUserSession(); |
|
199 | - $user = $userSession->getUser(); |
|
200 | - if ($user !== null) { |
|
201 | - $view = \OC\Files\Filesystem::getView(); |
|
202 | - $this->server->addPlugin( |
|
203 | - new FilesPlugin( |
|
204 | - $this->server->tree, |
|
205 | - \OC::$server->getConfig(), |
|
206 | - $this->request, |
|
207 | - \OC::$server->getPreviewManager(), |
|
208 | - false, |
|
209 | - !\OC::$server->getConfig()->getSystemValue('debug', false) |
|
210 | - ) |
|
211 | - ); |
|
195 | + // wait with registering these until auth is handled and the filesystem is setup |
|
196 | + $this->server->on('beforeMethod', function () use ($root) { |
|
197 | + // custom properties plugin must be the last one |
|
198 | + $userSession = \OC::$server->getUserSession(); |
|
199 | + $user = $userSession->getUser(); |
|
200 | + if ($user !== null) { |
|
201 | + $view = \OC\Files\Filesystem::getView(); |
|
202 | + $this->server->addPlugin( |
|
203 | + new FilesPlugin( |
|
204 | + $this->server->tree, |
|
205 | + \OC::$server->getConfig(), |
|
206 | + $this->request, |
|
207 | + \OC::$server->getPreviewManager(), |
|
208 | + false, |
|
209 | + !\OC::$server->getConfig()->getSystemValue('debug', false) |
|
210 | + ) |
|
211 | + ); |
|
212 | 212 | |
213 | - $this->server->addPlugin( |
|
214 | - new \Sabre\DAV\PropertyStorage\Plugin( |
|
215 | - new CustomPropertiesBackend( |
|
216 | - $this->server->tree, |
|
217 | - \OC::$server->getDatabaseConnection(), |
|
218 | - \OC::$server->getUserSession()->getUser() |
|
219 | - ) |
|
220 | - ) |
|
221 | - ); |
|
222 | - if ($view !== null) { |
|
223 | - $this->server->addPlugin( |
|
224 | - new QuotaPlugin($view, false)); |
|
225 | - } |
|
226 | - $this->server->addPlugin( |
|
227 | - new TagsPlugin( |
|
228 | - $this->server->tree, \OC::$server->getTagManager() |
|
229 | - ) |
|
230 | - ); |
|
231 | - // TODO: switch to LazyUserFolder |
|
232 | - $userFolder = \OC::$server->getUserFolder(); |
|
233 | - $this->server->addPlugin(new SharesPlugin( |
|
234 | - $this->server->tree, |
|
235 | - $userSession, |
|
236 | - $userFolder, |
|
237 | - \OC::$server->getShareManager() |
|
238 | - )); |
|
239 | - $this->server->addPlugin(new CommentPropertiesPlugin( |
|
240 | - \OC::$server->getCommentsManager(), |
|
241 | - $userSession |
|
242 | - )); |
|
243 | - $this->server->addPlugin(new \OCA\DAV\CalDAV\Search\SearchPlugin()); |
|
244 | - if ($view !== null) { |
|
245 | - $this->server->addPlugin(new FilesReportPlugin( |
|
246 | - $this->server->tree, |
|
247 | - $view, |
|
248 | - \OC::$server->getSystemTagManager(), |
|
249 | - \OC::$server->getSystemTagObjectMapper(), |
|
250 | - \OC::$server->getTagManager(), |
|
251 | - $userSession, |
|
252 | - \OC::$server->getGroupManager(), |
|
253 | - $userFolder |
|
254 | - )); |
|
255 | - $this->server->addPlugin(new SearchPlugin(new \OCA\DAV\Files\FileSearchBackend( |
|
256 | - $this->server->tree, |
|
257 | - $user, |
|
258 | - \OC::$server->getRootFolder(), |
|
259 | - \OC::$server->getShareManager(), |
|
260 | - $view |
|
261 | - ))); |
|
262 | - } |
|
263 | - $this->server->addPlugin(new \OCA\Dav\CalDAV\BirthdayCalendar\EnablePlugin( |
|
264 | - \OC::$server->getConfig(), |
|
265 | - \OC::$server->query(BirthdayService::class) |
|
266 | - )); |
|
267 | - } |
|
213 | + $this->server->addPlugin( |
|
214 | + new \Sabre\DAV\PropertyStorage\Plugin( |
|
215 | + new CustomPropertiesBackend( |
|
216 | + $this->server->tree, |
|
217 | + \OC::$server->getDatabaseConnection(), |
|
218 | + \OC::$server->getUserSession()->getUser() |
|
219 | + ) |
|
220 | + ) |
|
221 | + ); |
|
222 | + if ($view !== null) { |
|
223 | + $this->server->addPlugin( |
|
224 | + new QuotaPlugin($view, false)); |
|
225 | + } |
|
226 | + $this->server->addPlugin( |
|
227 | + new TagsPlugin( |
|
228 | + $this->server->tree, \OC::$server->getTagManager() |
|
229 | + ) |
|
230 | + ); |
|
231 | + // TODO: switch to LazyUserFolder |
|
232 | + $userFolder = \OC::$server->getUserFolder(); |
|
233 | + $this->server->addPlugin(new SharesPlugin( |
|
234 | + $this->server->tree, |
|
235 | + $userSession, |
|
236 | + $userFolder, |
|
237 | + \OC::$server->getShareManager() |
|
238 | + )); |
|
239 | + $this->server->addPlugin(new CommentPropertiesPlugin( |
|
240 | + \OC::$server->getCommentsManager(), |
|
241 | + $userSession |
|
242 | + )); |
|
243 | + $this->server->addPlugin(new \OCA\DAV\CalDAV\Search\SearchPlugin()); |
|
244 | + if ($view !== null) { |
|
245 | + $this->server->addPlugin(new FilesReportPlugin( |
|
246 | + $this->server->tree, |
|
247 | + $view, |
|
248 | + \OC::$server->getSystemTagManager(), |
|
249 | + \OC::$server->getSystemTagObjectMapper(), |
|
250 | + \OC::$server->getTagManager(), |
|
251 | + $userSession, |
|
252 | + \OC::$server->getGroupManager(), |
|
253 | + $userFolder |
|
254 | + )); |
|
255 | + $this->server->addPlugin(new SearchPlugin(new \OCA\DAV\Files\FileSearchBackend( |
|
256 | + $this->server->tree, |
|
257 | + $user, |
|
258 | + \OC::$server->getRootFolder(), |
|
259 | + \OC::$server->getShareManager(), |
|
260 | + $view |
|
261 | + ))); |
|
262 | + } |
|
263 | + $this->server->addPlugin(new \OCA\Dav\CalDAV\BirthdayCalendar\EnablePlugin( |
|
264 | + \OC::$server->getConfig(), |
|
265 | + \OC::$server->query(BirthdayService::class) |
|
266 | + )); |
|
267 | + } |
|
268 | 268 | |
269 | - // register plugins from apps |
|
270 | - $pluginManager = new PluginManager( |
|
271 | - \OC::$server, |
|
272 | - \OC::$server->getAppManager() |
|
273 | - ); |
|
274 | - foreach ($pluginManager->getAppPlugins() as $appPlugin) { |
|
275 | - $this->server->addPlugin($appPlugin); |
|
276 | - } |
|
277 | - foreach ($pluginManager->getAppCollections() as $appCollection) { |
|
278 | - $root->addChild($appCollection); |
|
279 | - } |
|
280 | - }); |
|
281 | - } |
|
269 | + // register plugins from apps |
|
270 | + $pluginManager = new PluginManager( |
|
271 | + \OC::$server, |
|
272 | + \OC::$server->getAppManager() |
|
273 | + ); |
|
274 | + foreach ($pluginManager->getAppPlugins() as $appPlugin) { |
|
275 | + $this->server->addPlugin($appPlugin); |
|
276 | + } |
|
277 | + foreach ($pluginManager->getAppCollections() as $appCollection) { |
|
278 | + $root->addChild($appCollection); |
|
279 | + } |
|
280 | + }); |
|
281 | + } |
|
282 | 282 | |
283 | - public function exec() { |
|
284 | - $this->server->exec(); |
|
285 | - } |
|
283 | + public function exec() { |
|
284 | + $this->server->exec(); |
|
285 | + } |
|
286 | 286 | } |