Completed
Pull Request — master (#9345)
by Björn
256:46 queued 240:36
created
apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@
 block discarded – undo
121 121
 	 * share received from another server
122 122
 	 *
123 123
 	 * @param ICloudFederationShare $share
124
-	 * @return string provider specific unique ID of the share
124
+	 * @return integer provider specific unique ID of the share
125 125
 	 *
126 126
 	 * @throws ProviderCouldNotAddShareException
127 127
 	 * @throws \OCP\AppFramework\QueryException
Please login to merge, or discard this patch.
Indentation   +452 added lines, -452 removed lines patch added patch discarded remove patch
@@ -50,458 +50,458 @@
 block discarded – undo
50 50
 
51 51
 class CloudFederationProviderFiles implements ICloudFederationProvider {
52 52
 
53
-	/** @var IAppManager */
54
-	private $appManager;
55
-
56
-	/** @var FederatedShareProvider */
57
-	private $federatedShareProvider;
58
-
59
-	/** @var AddressHandler */
60
-	private $addressHandler;
61
-
62
-	/** @var ILogger */
63
-	private $logger;
64
-
65
-	/** @var IUserManager */
66
-	private $userManager;
67
-
68
-	/** @var ICloudIdManager */
69
-	private $cloudIdManager;
70
-
71
-	/** @var IActivityManager */
72
-	private $activityManager;
73
-
74
-	/** @var INotificationManager */
75
-	private $notificationManager;
76
-
77
-	/** @var IURLGenerator */
78
-	private $urlGenerator;
79
-
80
-	/** @var ICloudFederationFactory */
81
-	private $cloudFederationFactory;
82
-
83
-	/** @var ICloudFederationProviderManager */
84
-	private $cloudFederationProviderManager;
85
-
86
-	/**
87
-	 * CloudFederationProvider constructor.
88
-	 *
89
-	 * @param IAppManager $appManager
90
-	 * @param FederatedShareProvider $federatedShareProvider
91
-	 * @param AddressHandler $addressHandler
92
-	 * @param ILogger $logger
93
-	 * @param IUserManager $userManager
94
-	 * @param ICloudIdManager $cloudIdManager
95
-	 * @param IActivityManager $activityManager
96
-	 * @param INotificationManager $notificationManager
97
-	 * @param IURLGenerator $urlGenerator
98
-	 * @param ICloudFederationFactory $cloudFederationFactory
99
-	 * @param ICloudFederationProviderManager $cloudFederationProviderManager
100
-	 */
101
-	public function __construct(IAppManager $appManager,
102
-								FederatedShareProvider $federatedShareProvider,
103
-								AddressHandler $addressHandler,
104
-								ILogger $logger,
105
-								IUserManager $userManager,
106
-								ICloudIdManager $cloudIdManager,
107
-								IActivityManager $activityManager,
108
-								INotificationManager $notificationManager,
109
-								IURLGenerator $urlGenerator,
110
-								ICloudFederationFactory $cloudFederationFactory,
111
-								ICloudFederationProviderManager $cloudFederationProviderManager
112
-	) {
113
-		$this->appManager = $appManager;
114
-		$this->federatedShareProvider = $federatedShareProvider;
115
-		$this->addressHandler = $addressHandler;
116
-		$this->logger = $logger;
117
-		$this->userManager = $userManager;
118
-		$this->cloudIdManager = $cloudIdManager;
119
-		$this->activityManager = $activityManager;
120
-		$this->notificationManager = $notificationManager;
121
-		$this->urlGenerator = $urlGenerator;
122
-		$this->cloudFederationFactory = $cloudFederationFactory;
123
-		$this->cloudFederationProviderManager = $cloudFederationProviderManager;
124
-	}
125
-
126
-
127
-
128
-	/**
129
-	 * @return string
130
-	 */
131
-	public function getShareType() {
132
-		return 'file';
133
-	}
134
-
135
-	/**
136
-	 * share received from another server
137
-	 *
138
-	 * @param ICloudFederationShare $share
139
-	 * @return string provider specific unique ID of the share
140
-	 *
141
-	 * @throws ProviderCouldNotAddShareException
142
-	 * @throws \OCP\AppFramework\QueryException
143
-	 * @throws \OC\HintException
144
-	 * @since 14.0.0
145
-	 */
146
-	public function shareReceived(ICloudFederationShare $share) {
147
-
148
-		if (!$this->isS2SEnabled(true)) {
149
-			throw new ProviderCouldNotAddShareException('Server does not support federated cloud sharing', '', Http::STATUS_SERVICE_UNAVAILABLE);
150
-		}
151
-
152
-		$protocol = $share->getProtocol();
153
-		if ($protocol['name'] !== 'webdav') {
154
-			throw new ProviderCouldNotAddShareException('Unsupported protocol for data exchange.', '', Http::STATUS_NOT_IMPLEMENTED);
155
-		}
156
-
157
-		list($ownerUid, $remote) = $this->addressHandler->splitUserRemote($share->getOwner());
158
-
159
-		$remote = $remote;
160
-		$token = $share->getShareSecret();
161
-		$name = $share->getResourceName();
162
-		$owner = $share->getOwnerDisplayName();
163
-		$sharedBy = $share->getSharedByDisplayName();
164
-		$shareWith = $share->getShareWith();
165
-		$remoteId = $share->getProviderId();
166
-		$sharedByFederatedId = $share->getSharedBy();
167
-		$ownerFederatedId = $share->getOwner();
168
-
169
-		// if no explicit information about the person who created the share was send
170
-		// we assume that the share comes from the owner
171
-		if ($sharedByFederatedId === null) {
172
-			$sharedBy = $owner;
173
-			$sharedByFederatedId = $ownerFederatedId;
174
-		}
175
-
176
-		if ($remote && $token && $name && $owner && $remoteId && $shareWith) {
177
-
178
-			if (!Util::isValidFileName($name)) {
179
-				throw new ProviderCouldNotAddShareException('The mountpoint name contains invalid characters.', '', Http::STATUS_BAD_REQUEST);
180
-			}
181
-
182
-			// FIXME this should be a method in the user management instead
183
-			$this->logger->debug('shareWith before, ' . $shareWith, ['app' => 'files_sharing']);
184
-			Util::emitHook(
185
-				'\OCA\Files_Sharing\API\Server2Server',
186
-				'preLoginNameUsedAsUserName',
187
-				array('uid' => &$shareWith)
188
-			);
189
-			$this->logger->debug('shareWith after, ' . $shareWith, ['app' => 'files_sharing']);
190
-
191
-			if (!$this->userManager->userExists($shareWith)) {
192
-				throw new ProviderCouldNotAddShareException('User does not exists', '',Http::STATUS_BAD_REQUEST);
193
-			}
194
-
195
-			\OC_Util::setupFS($shareWith);
196
-
197
-			$externalManager = new \OCA\Files_Sharing\External\Manager(
198
-				\OC::$server->getDatabaseConnection(),
199
-				Filesystem::getMountManager(),
200
-				Filesystem::getLoader(),
201
-				\OC::$server->getHTTPClientService(),
202
-				\OC::$server->getNotificationManager(),
203
-				\OC::$server->query(\OCP\OCS\IDiscoveryService::class),
204
-				\OC::$server->getCloudFederationProviderManager(),
205
-				\OC::$server->getCloudFederationFactory(),
206
-				$shareWith
207
-			);
208
-
209
-			try {
210
-				$externalManager->addShare($remote, $token, '', $name, $owner, false, $shareWith, $remoteId);
211
-				$shareId = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share_external');
212
-
213
-				$event = $this->activityManager->generateEvent();
214
-				$event->setApp('files_sharing')
215
-					->setType('remote_share')
216
-					->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_RECEIVED, [$ownerFederatedId, trim($name, '/')])
217
-					->setAffectedUser($shareWith)
218
-					->setObject('remote_share', (int)$shareId, $name);
219
-				\OC::$server->getActivityManager()->publish($event);
220
-
221
-				$notification = $this->notificationManager->createNotification();
222
-				$notification->setApp('files_sharing')
223
-					->setUser($shareWith)
224
-					->setDateTime(new \DateTime())
225
-					->setObject('remote_share', $shareId)
226
-					->setSubject('remote_share', [$ownerFederatedId, $sharedByFederatedId, trim($name, '/')]);
227
-
228
-				$declineAction = $notification->createAction();
229
-				$declineAction->setLabel('decline')
230
-					->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'DELETE');
231
-				$notification->addAction($declineAction);
232
-
233
-				$acceptAction = $notification->createAction();
234
-				$acceptAction->setLabel('accept')
235
-					->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'POST');
236
-				$notification->addAction($acceptAction);
237
-
238
-				$this->notificationManager->notify($notification);
239
-
240
-				return $shareId;
241
-			} catch (\Exception $e) {
242
-				$this->logger->logException($e, [
243
-					'message' => 'Server can not add remote share.',
244
-					'level' => Util::ERROR,
245
-					'app' => 'files_sharing'
246
-				]);
247
-				throw new ProviderCouldNotAddShareException('internal server error, was not able to add share from ' . $remote, '', HTTP::STATUS_INTERNAL_SERVER_ERROR);
248
-			}
249
-		}
250
-
251
-		throw new ProviderCouldNotAddShareException('server can not add remote share, missing parameter', '', HTTP::STATUS_BAD_REQUEST);
252
-
253
-	}
254
-
255
-	/**
256
-	 * notification received from another server
257
-	 *
258
-	 * @param string $notificationType (e.g. SHARE_ACCEPTED)
259
-	 * @param string $providerId id of the share
260
-	 * @param array $notification payload of the notification
261
-	 *
262
-	 * @throws ActionNotSupportedException
263
-	 * @throws AuthenticationFailedException
264
-	 * @throws BadRequestException
265
-	 * @throws ShareNotFoundException
266
-	 * @throws \OC\HintException
267
-	 * @since 14.0.0
268
-	 */
269
-	public function notificationReceived($notificationType, $providerId, array $notification) {
270
-
271
-		switch ($notificationType) {
272
-			case 'SHARE_ACCEPTED':
273
-				$this->shareAccepted($providerId, $notification);
274
-				return;
275
-			case 'SHARE_DECLINED':
276
-				$this->shareDeclined($providerId, $notification);
277
-				return;
278
-		}
279
-
280
-
281
-		throw new BadRequestException([$notificationType]);
282
-	}
283
-
284
-	/**
285
-	 * @param string $id
286
-	 * @param array $notification
287
-	 * @return bool
288
-	 * @throws ActionNotSupportedException
289
-	 * @throws AuthenticationFailedException
290
-	 * @throws BadRequestException
291
-	 * @throws ShareNotFoundException
292
-	 * @throws \OC\HintException
293
-	 */
294
-	private function shareAccepted($id, $notification) {
295
-
296
-		if (!$this->isS2SEnabled()) {
297
-			throw new ActionNotSupportedException('Server does not support federated cloud sharing');
298
-		}
299
-
300
-		if (!isset($notification['sharedSecret'])) {
301
-			throw new BadRequestException(['sharedSecret']);
302
-		}
303
-
304
-		$token = $notification['sharedSecret'];
305
-
306
-		$share = $this->federatedShareProvider->getShareById($id);
307
-
308
-		$this->verifyShare($share, $token);
309
-		$this->executeAcceptShare($share);
310
-		if ($share->getShareOwner() !== $share->getSharedBy()) {
311
-			list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy());
312
-			$remoteId = $this->federatedShareProvider->getRemoteId($share);
313
-			$notification = $this->cloudFederationFactory->getCloudFederationNotification();
314
-			$notification->setMessage(
315
-				'SHARE_ACCEPTED',
316
-				'file',
317
-				$remoteId,
318
-				[
319
-					'sharedSecret' => $token,
320
-					'message' => 'Recipient accepted the re-share'
321
-				]
322
-
323
-			);
324
-			$this->cloudFederationProviderManager->sendNotification($remote, $notification);
325
-
326
-		}
327
-
328
-		return true;
329
-	}
330
-
331
-	/**
332
-	 * @param IShare $share
333
-	 * @throws ShareNotFoundException
334
-	 */
335
-	protected function executeAcceptShare(IShare $share) {
336
-		try {
337
-			$fileId = (int)$share->getNode()->getId();
338
-			list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId);
339
-		} catch (\Exception $e) {
340
-			throw new ShareNotFoundException();
341
-		}
342
-
343
-		$event = $this->activityManager->generateEvent();
344
-		$event->setApp('files_sharing')
345
-			->setType('remote_share')
346
-			->setAffectedUser($this->getCorrectUid($share))
347
-			->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_ACCEPTED, [$share->getSharedWith(), [$fileId => $file]])
348
-			->setObject('files', $fileId, $file)
349
-			->setLink($link);
350
-		$this->activityManager->publish($event);
351
-	}
352
-
353
-	/**
354
-	 * @param string $id
355
-	 * @param array $notification
356
-	 * @throws ActionNotSupportedException
357
-	 * @throws AuthenticationFailedException
358
-	 * @throws BadRequestException
359
-	 * @throws ShareNotFound
360
-	 * @throws ShareNotFoundException
361
-	 * @throws \OC\HintException
362
-	 */
363
-	protected function shareDeclined($id, $notification) {
364
-
365
-		if (!$this->isS2SEnabled()) {
366
-			throw new ActionNotSupportedException('Server does not support federated cloud sharing');
367
-		}
368
-
369
-		if (!isset($notification['sharedSecret'])) {
370
-			throw new BadRequestException(['sharedSecret']);
371
-		}
372
-
373
-		$token = $notification['sharedSecret'];
374
-
375
-		$share = $this->federatedShareProvider->getShareById($id);
376
-
377
-		$this->verifyShare($share, $token);
378
-
379
-		if ($share->getShareOwner() !== $share->getSharedBy()) {
380
-			list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy());
381
-			$remoteId = $this->federatedShareProvider->getRemoteId($share);
382
-			$notification = $this->cloudFederationFactory->getCloudFederationNotification();
383
-			$notification->setMessage(
384
-				'SHARE_DECLINED',
385
-				'file',
386
-				$remoteId,
387
-				[
388
-					'sharedSecret' => $token,
389
-					'message' => 'Recipient declined the re-share'
390
-				]
391
-
392
-			);
393
-			$this->cloudFederationProviderManager->sendNotification($remote, $notification);
394
-		}
395
-
396
-		$this->executeDeclineShare($share);
397
-
398
-	}
399
-
400
-	/**
401
-	 * delete declined share and create a activity
402
-	 *
403
-	 * @param IShare $share
404
-	 * @throws ShareNotFoundException
405
-	 */
406
-	protected function executeDeclineShare(IShare $share) {
407
-		$this->federatedShareProvider->removeShareFromTable($share);
408
-
409
-		try {
410
-			$fileId = (int)$share->getNode()->getId();
411
-			list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId);
412
-		} catch (\Exception $e) {
413
-			throw new ShareNotFoundException();
414
-		}
415
-
416
-		$event = $this->activityManager->generateEvent();
417
-		$event->setApp('files_sharing')
418
-			->setType('remote_share')
419
-			->setAffectedUser($this->getCorrectUid($share))
420
-			->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_DECLINED, [$share->getSharedWith(), [$fileId => $file]])
421
-			->setObject('files', $fileId, $file)
422
-			->setLink($link);
423
-		$this->activityManager->publish($event);
424
-
425
-	}
426
-
427
-
428
-	/**
429
-	 * get file
430
-	 *
431
-	 * @param string $user
432
-	 * @param int $fileSource
433
-	 * @return array with internal path of the file and a absolute link to it
434
-	 */
435
-	private function getFile($user, $fileSource) {
436
-		\OC_Util::setupFS($user);
437
-
438
-		try {
439
-			$file = Filesystem::getPath($fileSource);
440
-		} catch (NotFoundException $e) {
441
-			$file = null;
442
-		}
443
-		$args = Filesystem::is_dir($file) ? array('dir' => $file) : array('dir' => dirname($file), 'scrollto' => $file);
444
-		$link = Util::linkToAbsolute('files', 'index.php', $args);
445
-
446
-		return array($file, $link);
447
-
448
-	}
449
-
450
-	/**
451
-	 * check if we are the initiator or the owner of a re-share and return the correct UID
452
-	 *
453
-	 * @param IShare $share
454
-	 * @return string
455
-	 */
456
-	protected function getCorrectUid(IShare $share) {
457
-		if ($this->userManager->userExists($share->getShareOwner())) {
458
-			return $share->getShareOwner();
459
-		}
460
-
461
-		return $share->getSharedBy();
462
-	}
463
-
464
-
465
-
466
-	/**
467
-	 * check if we got the right share
468
-	 *
469
-	 * @param IShare $share
470
-	 * @param string $token
471
-	 * @return bool
472
-	 * @throws AuthenticationFailedException
473
-	 */
474
-	protected function verifyShare(IShare $share, $token) {
475
-		if (
476
-			$share->getShareType() === FederatedShareProvider::SHARE_TYPE_REMOTE &&
477
-			$share->getToken() === $token
478
-		) {
479
-			return true;
480
-		}
481
-
482
-		throw new AuthenticationFailedException();
483
-	}
484
-
485
-
486
-
487
-	/**
488
-	 * check if server-to-server sharing is enabled
489
-	 *
490
-	 * @param bool $incoming
491
-	 * @return bool
492
-	 */
493
-	private function isS2SEnabled($incoming = false) {
494
-
495
-		$result = $this->appManager->isEnabledForUser('files_sharing');
496
-
497
-		if ($incoming) {
498
-			$result = $result && $this->federatedShareProvider->isIncomingServer2serverShareEnabled();
499
-		} else {
500
-			$result = $result && $this->federatedShareProvider->isOutgoingServer2serverShareEnabled();
501
-		}
502
-
503
-		return $result;
504
-	}
53
+    /** @var IAppManager */
54
+    private $appManager;
55
+
56
+    /** @var FederatedShareProvider */
57
+    private $federatedShareProvider;
58
+
59
+    /** @var AddressHandler */
60
+    private $addressHandler;
61
+
62
+    /** @var ILogger */
63
+    private $logger;
64
+
65
+    /** @var IUserManager */
66
+    private $userManager;
67
+
68
+    /** @var ICloudIdManager */
69
+    private $cloudIdManager;
70
+
71
+    /** @var IActivityManager */
72
+    private $activityManager;
73
+
74
+    /** @var INotificationManager */
75
+    private $notificationManager;
76
+
77
+    /** @var IURLGenerator */
78
+    private $urlGenerator;
79
+
80
+    /** @var ICloudFederationFactory */
81
+    private $cloudFederationFactory;
82
+
83
+    /** @var ICloudFederationProviderManager */
84
+    private $cloudFederationProviderManager;
85
+
86
+    /**
87
+     * CloudFederationProvider constructor.
88
+     *
89
+     * @param IAppManager $appManager
90
+     * @param FederatedShareProvider $federatedShareProvider
91
+     * @param AddressHandler $addressHandler
92
+     * @param ILogger $logger
93
+     * @param IUserManager $userManager
94
+     * @param ICloudIdManager $cloudIdManager
95
+     * @param IActivityManager $activityManager
96
+     * @param INotificationManager $notificationManager
97
+     * @param IURLGenerator $urlGenerator
98
+     * @param ICloudFederationFactory $cloudFederationFactory
99
+     * @param ICloudFederationProviderManager $cloudFederationProviderManager
100
+     */
101
+    public function __construct(IAppManager $appManager,
102
+                                FederatedShareProvider $federatedShareProvider,
103
+                                AddressHandler $addressHandler,
104
+                                ILogger $logger,
105
+                                IUserManager $userManager,
106
+                                ICloudIdManager $cloudIdManager,
107
+                                IActivityManager $activityManager,
108
+                                INotificationManager $notificationManager,
109
+                                IURLGenerator $urlGenerator,
110
+                                ICloudFederationFactory $cloudFederationFactory,
111
+                                ICloudFederationProviderManager $cloudFederationProviderManager
112
+    ) {
113
+        $this->appManager = $appManager;
114
+        $this->federatedShareProvider = $federatedShareProvider;
115
+        $this->addressHandler = $addressHandler;
116
+        $this->logger = $logger;
117
+        $this->userManager = $userManager;
118
+        $this->cloudIdManager = $cloudIdManager;
119
+        $this->activityManager = $activityManager;
120
+        $this->notificationManager = $notificationManager;
121
+        $this->urlGenerator = $urlGenerator;
122
+        $this->cloudFederationFactory = $cloudFederationFactory;
123
+        $this->cloudFederationProviderManager = $cloudFederationProviderManager;
124
+    }
125
+
126
+
127
+
128
+    /**
129
+     * @return string
130
+     */
131
+    public function getShareType() {
132
+        return 'file';
133
+    }
134
+
135
+    /**
136
+     * share received from another server
137
+     *
138
+     * @param ICloudFederationShare $share
139
+     * @return string provider specific unique ID of the share
140
+     *
141
+     * @throws ProviderCouldNotAddShareException
142
+     * @throws \OCP\AppFramework\QueryException
143
+     * @throws \OC\HintException
144
+     * @since 14.0.0
145
+     */
146
+    public function shareReceived(ICloudFederationShare $share) {
147
+
148
+        if (!$this->isS2SEnabled(true)) {
149
+            throw new ProviderCouldNotAddShareException('Server does not support federated cloud sharing', '', Http::STATUS_SERVICE_UNAVAILABLE);
150
+        }
151
+
152
+        $protocol = $share->getProtocol();
153
+        if ($protocol['name'] !== 'webdav') {
154
+            throw new ProviderCouldNotAddShareException('Unsupported protocol for data exchange.', '', Http::STATUS_NOT_IMPLEMENTED);
155
+        }
156
+
157
+        list($ownerUid, $remote) = $this->addressHandler->splitUserRemote($share->getOwner());
158
+
159
+        $remote = $remote;
160
+        $token = $share->getShareSecret();
161
+        $name = $share->getResourceName();
162
+        $owner = $share->getOwnerDisplayName();
163
+        $sharedBy = $share->getSharedByDisplayName();
164
+        $shareWith = $share->getShareWith();
165
+        $remoteId = $share->getProviderId();
166
+        $sharedByFederatedId = $share->getSharedBy();
167
+        $ownerFederatedId = $share->getOwner();
168
+
169
+        // if no explicit information about the person who created the share was send
170
+        // we assume that the share comes from the owner
171
+        if ($sharedByFederatedId === null) {
172
+            $sharedBy = $owner;
173
+            $sharedByFederatedId = $ownerFederatedId;
174
+        }
175
+
176
+        if ($remote && $token && $name && $owner && $remoteId && $shareWith) {
177
+
178
+            if (!Util::isValidFileName($name)) {
179
+                throw new ProviderCouldNotAddShareException('The mountpoint name contains invalid characters.', '', Http::STATUS_BAD_REQUEST);
180
+            }
181
+
182
+            // FIXME this should be a method in the user management instead
183
+            $this->logger->debug('shareWith before, ' . $shareWith, ['app' => 'files_sharing']);
184
+            Util::emitHook(
185
+                '\OCA\Files_Sharing\API\Server2Server',
186
+                'preLoginNameUsedAsUserName',
187
+                array('uid' => &$shareWith)
188
+            );
189
+            $this->logger->debug('shareWith after, ' . $shareWith, ['app' => 'files_sharing']);
190
+
191
+            if (!$this->userManager->userExists($shareWith)) {
192
+                throw new ProviderCouldNotAddShareException('User does not exists', '',Http::STATUS_BAD_REQUEST);
193
+            }
194
+
195
+            \OC_Util::setupFS($shareWith);
196
+
197
+            $externalManager = new \OCA\Files_Sharing\External\Manager(
198
+                \OC::$server->getDatabaseConnection(),
199
+                Filesystem::getMountManager(),
200
+                Filesystem::getLoader(),
201
+                \OC::$server->getHTTPClientService(),
202
+                \OC::$server->getNotificationManager(),
203
+                \OC::$server->query(\OCP\OCS\IDiscoveryService::class),
204
+                \OC::$server->getCloudFederationProviderManager(),
205
+                \OC::$server->getCloudFederationFactory(),
206
+                $shareWith
207
+            );
208
+
209
+            try {
210
+                $externalManager->addShare($remote, $token, '', $name, $owner, false, $shareWith, $remoteId);
211
+                $shareId = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share_external');
212
+
213
+                $event = $this->activityManager->generateEvent();
214
+                $event->setApp('files_sharing')
215
+                    ->setType('remote_share')
216
+                    ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_RECEIVED, [$ownerFederatedId, trim($name, '/')])
217
+                    ->setAffectedUser($shareWith)
218
+                    ->setObject('remote_share', (int)$shareId, $name);
219
+                \OC::$server->getActivityManager()->publish($event);
220
+
221
+                $notification = $this->notificationManager->createNotification();
222
+                $notification->setApp('files_sharing')
223
+                    ->setUser($shareWith)
224
+                    ->setDateTime(new \DateTime())
225
+                    ->setObject('remote_share', $shareId)
226
+                    ->setSubject('remote_share', [$ownerFederatedId, $sharedByFederatedId, trim($name, '/')]);
227
+
228
+                $declineAction = $notification->createAction();
229
+                $declineAction->setLabel('decline')
230
+                    ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'DELETE');
231
+                $notification->addAction($declineAction);
232
+
233
+                $acceptAction = $notification->createAction();
234
+                $acceptAction->setLabel('accept')
235
+                    ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'POST');
236
+                $notification->addAction($acceptAction);
237
+
238
+                $this->notificationManager->notify($notification);
239
+
240
+                return $shareId;
241
+            } catch (\Exception $e) {
242
+                $this->logger->logException($e, [
243
+                    'message' => 'Server can not add remote share.',
244
+                    'level' => Util::ERROR,
245
+                    'app' => 'files_sharing'
246
+                ]);
247
+                throw new ProviderCouldNotAddShareException('internal server error, was not able to add share from ' . $remote, '', HTTP::STATUS_INTERNAL_SERVER_ERROR);
248
+            }
249
+        }
250
+
251
+        throw new ProviderCouldNotAddShareException('server can not add remote share, missing parameter', '', HTTP::STATUS_BAD_REQUEST);
252
+
253
+    }
254
+
255
+    /**
256
+     * notification received from another server
257
+     *
258
+     * @param string $notificationType (e.g. SHARE_ACCEPTED)
259
+     * @param string $providerId id of the share
260
+     * @param array $notification payload of the notification
261
+     *
262
+     * @throws ActionNotSupportedException
263
+     * @throws AuthenticationFailedException
264
+     * @throws BadRequestException
265
+     * @throws ShareNotFoundException
266
+     * @throws \OC\HintException
267
+     * @since 14.0.0
268
+     */
269
+    public function notificationReceived($notificationType, $providerId, array $notification) {
270
+
271
+        switch ($notificationType) {
272
+            case 'SHARE_ACCEPTED':
273
+                $this->shareAccepted($providerId, $notification);
274
+                return;
275
+            case 'SHARE_DECLINED':
276
+                $this->shareDeclined($providerId, $notification);
277
+                return;
278
+        }
279
+
280
+
281
+        throw new BadRequestException([$notificationType]);
282
+    }
283
+
284
+    /**
285
+     * @param string $id
286
+     * @param array $notification
287
+     * @return bool
288
+     * @throws ActionNotSupportedException
289
+     * @throws AuthenticationFailedException
290
+     * @throws BadRequestException
291
+     * @throws ShareNotFoundException
292
+     * @throws \OC\HintException
293
+     */
294
+    private function shareAccepted($id, $notification) {
295
+
296
+        if (!$this->isS2SEnabled()) {
297
+            throw new ActionNotSupportedException('Server does not support federated cloud sharing');
298
+        }
299
+
300
+        if (!isset($notification['sharedSecret'])) {
301
+            throw new BadRequestException(['sharedSecret']);
302
+        }
303
+
304
+        $token = $notification['sharedSecret'];
305
+
306
+        $share = $this->federatedShareProvider->getShareById($id);
307
+
308
+        $this->verifyShare($share, $token);
309
+        $this->executeAcceptShare($share);
310
+        if ($share->getShareOwner() !== $share->getSharedBy()) {
311
+            list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy());
312
+            $remoteId = $this->federatedShareProvider->getRemoteId($share);
313
+            $notification = $this->cloudFederationFactory->getCloudFederationNotification();
314
+            $notification->setMessage(
315
+                'SHARE_ACCEPTED',
316
+                'file',
317
+                $remoteId,
318
+                [
319
+                    'sharedSecret' => $token,
320
+                    'message' => 'Recipient accepted the re-share'
321
+                ]
322
+
323
+            );
324
+            $this->cloudFederationProviderManager->sendNotification($remote, $notification);
325
+
326
+        }
327
+
328
+        return true;
329
+    }
330
+
331
+    /**
332
+     * @param IShare $share
333
+     * @throws ShareNotFoundException
334
+     */
335
+    protected function executeAcceptShare(IShare $share) {
336
+        try {
337
+            $fileId = (int)$share->getNode()->getId();
338
+            list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId);
339
+        } catch (\Exception $e) {
340
+            throw new ShareNotFoundException();
341
+        }
342
+
343
+        $event = $this->activityManager->generateEvent();
344
+        $event->setApp('files_sharing')
345
+            ->setType('remote_share')
346
+            ->setAffectedUser($this->getCorrectUid($share))
347
+            ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_ACCEPTED, [$share->getSharedWith(), [$fileId => $file]])
348
+            ->setObject('files', $fileId, $file)
349
+            ->setLink($link);
350
+        $this->activityManager->publish($event);
351
+    }
352
+
353
+    /**
354
+     * @param string $id
355
+     * @param array $notification
356
+     * @throws ActionNotSupportedException
357
+     * @throws AuthenticationFailedException
358
+     * @throws BadRequestException
359
+     * @throws ShareNotFound
360
+     * @throws ShareNotFoundException
361
+     * @throws \OC\HintException
362
+     */
363
+    protected function shareDeclined($id, $notification) {
364
+
365
+        if (!$this->isS2SEnabled()) {
366
+            throw new ActionNotSupportedException('Server does not support federated cloud sharing');
367
+        }
368
+
369
+        if (!isset($notification['sharedSecret'])) {
370
+            throw new BadRequestException(['sharedSecret']);
371
+        }
372
+
373
+        $token = $notification['sharedSecret'];
374
+
375
+        $share = $this->federatedShareProvider->getShareById($id);
376
+
377
+        $this->verifyShare($share, $token);
378
+
379
+        if ($share->getShareOwner() !== $share->getSharedBy()) {
380
+            list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy());
381
+            $remoteId = $this->federatedShareProvider->getRemoteId($share);
382
+            $notification = $this->cloudFederationFactory->getCloudFederationNotification();
383
+            $notification->setMessage(
384
+                'SHARE_DECLINED',
385
+                'file',
386
+                $remoteId,
387
+                [
388
+                    'sharedSecret' => $token,
389
+                    'message' => 'Recipient declined the re-share'
390
+                ]
391
+
392
+            );
393
+            $this->cloudFederationProviderManager->sendNotification($remote, $notification);
394
+        }
395
+
396
+        $this->executeDeclineShare($share);
397
+
398
+    }
399
+
400
+    /**
401
+     * delete declined share and create a activity
402
+     *
403
+     * @param IShare $share
404
+     * @throws ShareNotFoundException
405
+     */
406
+    protected function executeDeclineShare(IShare $share) {
407
+        $this->federatedShareProvider->removeShareFromTable($share);
408
+
409
+        try {
410
+            $fileId = (int)$share->getNode()->getId();
411
+            list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId);
412
+        } catch (\Exception $e) {
413
+            throw new ShareNotFoundException();
414
+        }
415
+
416
+        $event = $this->activityManager->generateEvent();
417
+        $event->setApp('files_sharing')
418
+            ->setType('remote_share')
419
+            ->setAffectedUser($this->getCorrectUid($share))
420
+            ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_DECLINED, [$share->getSharedWith(), [$fileId => $file]])
421
+            ->setObject('files', $fileId, $file)
422
+            ->setLink($link);
423
+        $this->activityManager->publish($event);
424
+
425
+    }
426
+
427
+
428
+    /**
429
+     * get file
430
+     *
431
+     * @param string $user
432
+     * @param int $fileSource
433
+     * @return array with internal path of the file and a absolute link to it
434
+     */
435
+    private function getFile($user, $fileSource) {
436
+        \OC_Util::setupFS($user);
437
+
438
+        try {
439
+            $file = Filesystem::getPath($fileSource);
440
+        } catch (NotFoundException $e) {
441
+            $file = null;
442
+        }
443
+        $args = Filesystem::is_dir($file) ? array('dir' => $file) : array('dir' => dirname($file), 'scrollto' => $file);
444
+        $link = Util::linkToAbsolute('files', 'index.php', $args);
445
+
446
+        return array($file, $link);
447
+
448
+    }
449
+
450
+    /**
451
+     * check if we are the initiator or the owner of a re-share and return the correct UID
452
+     *
453
+     * @param IShare $share
454
+     * @return string
455
+     */
456
+    protected function getCorrectUid(IShare $share) {
457
+        if ($this->userManager->userExists($share->getShareOwner())) {
458
+            return $share->getShareOwner();
459
+        }
460
+
461
+        return $share->getSharedBy();
462
+    }
463
+
464
+
465
+
466
+    /**
467
+     * check if we got the right share
468
+     *
469
+     * @param IShare $share
470
+     * @param string $token
471
+     * @return bool
472
+     * @throws AuthenticationFailedException
473
+     */
474
+    protected function verifyShare(IShare $share, $token) {
475
+        if (
476
+            $share->getShareType() === FederatedShareProvider::SHARE_TYPE_REMOTE &&
477
+            $share->getToken() === $token
478
+        ) {
479
+            return true;
480
+        }
481
+
482
+        throw new AuthenticationFailedException();
483
+    }
484
+
485
+
486
+
487
+    /**
488
+     * check if server-to-server sharing is enabled
489
+     *
490
+     * @param bool $incoming
491
+     * @return bool
492
+     */
493
+    private function isS2SEnabled($incoming = false) {
494
+
495
+        $result = $this->appManager->isEnabledForUser('files_sharing');
496
+
497
+        if ($incoming) {
498
+            $result = $result && $this->federatedShareProvider->isIncomingServer2serverShareEnabled();
499
+        } else {
500
+            $result = $result && $this->federatedShareProvider->isOutgoingServer2serverShareEnabled();
501
+        }
502
+
503
+        return $result;
504
+    }
505 505
 
506 506
 
507 507
 }
Please login to merge, or discard this patch.
ocm-provider/index.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@
 block discarded – undo
29 29
 $isEnabled = $server->getAppManager()->isEnabledForUser('cloud_federation_api');
30 30
 
31 31
 if ($isEnabled) {
32
-	$capabilities = new OCA\CloudFederationAPI\Capabilities($server->getURLGenerator());
33
-	header('Content-Type: application/json');
34
-	echo json_encode($capabilities->getCapabilities()['ocm']);
32
+    $capabilities = new OCA\CloudFederationAPI\Capabilities($server->getURLGenerator());
33
+    header('Content-Type: application/json');
34
+    echo json_encode($capabilities->getCapabilities()['ocm']);
35 35
 } else {
36
-	header($_SERVER["SERVER_PROTOCOL"]." 501 Not Implemented", true, 501);
37
-	exit("501 Not Implemented");
36
+    header($_SERVER["SERVER_PROTOCOL"]." 501 Not Implemented", true, 501);
37
+    exit("501 Not Implemented");
38 38
 }
39 39
 
Please login to merge, or discard this patch.
apps/cloud_federation_api/lib/Config.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,15 +32,15 @@
 block discarded – undo
32 32
  */
33 33
 class Config {
34 34
 
35
-	public function __construct() {
36
-	}
35
+    public function __construct() {
36
+    }
37 37
 
38
-	public function incomingRequestsEnabled() {
39
-		return true;
40
-	}
38
+    public function incomingRequestsEnabled() {
39
+        return true;
40
+    }
41 41
 
42
-	public function outgoingRequestsEnabled() {
43
-		return true;
44
-	}
42
+    public function outgoingRequestsEnabled() {
43
+        return true;
44
+    }
45 45
 
46 46
 }
Please login to merge, or discard this patch.
apps/cloud_federation_api/lib/AppInfo/Application.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@
 block discarded – undo
28 28
 
29 29
 class Application extends App {
30 30
 
31
-	public function __construct() {
32
-		parent::__construct('cloud_federation_api');
31
+    public function __construct() {
32
+        parent::__construct('cloud_federation_api');
33 33
 
34
-		$container = $this->getContainer();
35
-		$container->registerCapability(Capabilities::class);
36
-	}
34
+        $container = $this->getContainer();
35
+        $container->registerCapability(Capabilities::class);
36
+    }
37 37
 }
Please login to merge, or discard this patch.
lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@
 block discarded – undo
26 26
 
27 27
 class ProviderCouldNotAddShareException extends HintException {
28 28
 
29
-	public function __construct($message, $hint = '', $code = Http::STATUS_BAD_REQUEST, \Exception $previous = null) {
30
-		parent::__construct($message, $hint, $code, $previous);
31
-	}
29
+    public function __construct($message, $hint = '', $code = Http::STATUS_BAD_REQUEST, \Exception $previous = null) {
30
+        parent::__construct($message, $hint, $code, $previous);
31
+    }
32 32
 
33 33
 
34 34
 }
Please login to merge, or discard this patch.
lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -25,16 +25,16 @@
 block discarded – undo
25 25
 
26 26
 class ProviderDoesNotExistsException extends HintException {
27 27
 
28
-	/**
29
-	 * ProviderDoesNotExistsException constructor.
30
-	 *
31
-	 * @param string $providerId cloud federation provider ID
32
-	 */
33
-	public function __construct($providerId) {
34
-		$l = \OC::$server->getL10N('federation');
35
-		$message = 'Cloud Federation Provider with ID: "' . $providerId . '" does not exist.';
36
-		$hint = $l->t('Cloud Federation Provider with ID: "%s" does not exist.', [$providerId]);
37
-		parent::__construct($message, $hint);
38
-	}
28
+    /**
29
+     * ProviderDoesNotExistsException constructor.
30
+     *
31
+     * @param string $providerId cloud federation provider ID
32
+     */
33
+    public function __construct($providerId) {
34
+        $l = \OC::$server->getL10N('federation');
35
+        $message = 'Cloud Federation Provider with ID: "' . $providerId . '" does not exist.';
36
+        $hint = $l->t('Cloud Federation Provider with ID: "%s" does not exist.', [$providerId]);
37
+        parent::__construct($message, $hint);
38
+    }
39 39
 
40 40
 }
Please login to merge, or discard this patch.
lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -25,17 +25,17 @@
 block discarded – undo
25 25
 
26 26
 class ProviderAlreadyExistsException extends HintException {
27 27
 
28
-	/**
29
-	 * ProviderAlreadyExistsException constructor.
30
-	 *
31
-	 * @param string $newProviderId cloud federation provider ID of the new provider
32
-	 * @param string $existingProviderName name of cloud federation provider which already use the same ID
33
-	 */
34
-	public function __construct($newProviderId, $existingProviderName) {
35
-		$l = \OC::$server->getL10N('federation');
36
-		$message = 'Id "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"';
37
-		$hint = $l->t('Id "%s" already used by cloud federation provider "%s"', [$newProviderId, $existingProviderName]);
38
-		parent::__construct($message, $hint);
39
-	}
28
+    /**
29
+     * ProviderAlreadyExistsException constructor.
30
+     *
31
+     * @param string $newProviderId cloud federation provider ID of the new provider
32
+     * @param string $existingProviderName name of cloud federation provider which already use the same ID
33
+     */
34
+    public function __construct($newProviderId, $existingProviderName) {
35
+        $l = \OC::$server->getL10N('federation');
36
+        $message = 'Id "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"';
37
+        $hint = $l->t('Id "%s" already used by cloud federation provider "%s"', [$newProviderId, $existingProviderName]);
38
+        parent::__construct($message, $hint);
39
+    }
40 40
 
41 41
 }
Please login to merge, or discard this patch.
core/routes.php 1 patch
Indentation   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -36,47 +36,47 @@  discard block
 block discarded – undo
36 36
 
37 37
 $application = new Application();
38 38
 $application->registerRoutes($this, [
39
-	'routes' => [
40
-		['name' => 'lost#email', 'url' => '/lostpassword/email', 'verb' => 'POST'],
41
-		['name' => 'lost#resetform', 'url' => '/lostpassword/reset/form/{token}/{userId}', 'verb' => 'GET'],
42
-		['name' => 'lost#setPassword', 'url' => '/lostpassword/set/{token}/{userId}', 'verb' => 'POST'],
43
-		['name' => 'user#getDisplayNames', 'url' => '/displaynames', 'verb' => 'POST'],
44
-		['name' => 'avatar#getAvatar', 'url' => '/avatar/{userId}/{size}', 'verb' => 'GET'],
45
-		['name' => 'avatar#deleteAvatar', 'url' => '/avatar/', 'verb' => 'DELETE'],
46
-		['name' => 'avatar#postCroppedAvatar', 'url' => '/avatar/cropped', 'verb' => 'POST'],
47
-		['name' => 'avatar#getTmpAvatar', 'url' => '/avatar/tmp', 'verb' => 'GET'],
48
-		['name' => 'avatar#postAvatar', 'url' => '/avatar/', 'verb' => 'POST'],
49
-		['name' => 'CSRFToken#index', 'url' => '/csrftoken', 'verb' => 'GET'],
50
-		['name' => 'login#tryLogin', 'url' => '/login', 'verb' => 'POST'],
51
-		['name' => 'login#confirmPassword', 'url' => '/login/confirm', 'verb' => 'POST'],
52
-		['name' => 'login#showLoginForm', 'url' => '/login', 'verb' => 'GET'],
53
-		['name' => 'login#logout', 'url' => '/logout', 'verb' => 'GET'],
54
-		['name' => 'ClientFlowLogin#showAuthPickerPage', 'url' => '/login/flow', 'verb' => 'GET'],
55
-		['name' => 'ClientFlowLogin#redirectPage', 'url' => '/login/flow/redirect', 'verb' => 'GET'],
56
-		['name' => 'ClientFlowLogin#generateAppPassword', 'url' => '/login/flow', 'verb' => 'POST'],
57
-		['name' => 'ClientFlowLogin#grantPage', 'url' => '/login/flow/grant', 'verb' => 'GET'],
58
-		['name' => 'TwoFactorChallenge#selectChallenge', 'url' => '/login/selectchallenge', 'verb' => 'GET'],
59
-		['name' => 'TwoFactorChallenge#showChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'GET'],
60
-		['name' => 'TwoFactorChallenge#solveChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'POST'],
61
-		['name' => 'OCJS#getConfig', 'url' => '/core/js/oc.js', 'verb' => 'GET'],
62
-		['name' => 'Preview#getPreviewByFileId', 'url' => '/core/preview', 'verb' => 'GET'],
63
-		['name' => 'Preview#getPreview', 'url' => '/core/preview.png', 'verb' => 'GET'],
64
-		['name' => 'Css#getCss', 'url' => '/css/{appName}/{fileName}', 'verb' => 'GET'],
65
-		['name' => 'Js#getJs', 'url' => '/js/{appName}/{fileName}', 'verb' => 'GET'],
66
-		['name' => 'contactsMenu#index', 'url' => '/contactsmenu/contacts', 'verb' => 'POST'],
67
-		['name' => 'contactsMenu#findOne', 'url' => '/contactsmenu/findOne', 'verb' => 'POST'],
68
-		['name' => 'WalledGarden#get', 'url' => '/204', 'verb' => 'GET'],
69
-		['name' => 'Search#search', 'url' => '/core/search', 'verb' => 'GET'],
70
-	],
71
-	'ocs' => [
72
-		['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'],
73
-		['root' => '', 'name' => 'OCS#getConfig', 'url' => '/config', 'verb' => 'GET'],
74
-		['root' => '/person', 'name' => 'OCS#personCheck', 'url' => '/check', 'verb' => 'POST'],
75
-		['root' => '/identityproof', 'name' => 'OCS#getIdentityProof', 'url' => '/key/{cloudId}', 'verb' => 'GET'],
76
-		['root' => '/core', 'name' => 'Navigation#getAppsNavigation', 'url' => '/navigation/apps', 'verb' => 'GET'],
77
-		['root' => '/core', 'name' => 'Navigation#getSettingsNavigation', 'url' => '/navigation/settings', 'verb' => 'GET'],
78
-		['root' => '/core', 'name' => 'AutoComplete#get', 'url' => '/autocomplete/get', 'verb' => 'GET'],
79
-	],
39
+    'routes' => [
40
+        ['name' => 'lost#email', 'url' => '/lostpassword/email', 'verb' => 'POST'],
41
+        ['name' => 'lost#resetform', 'url' => '/lostpassword/reset/form/{token}/{userId}', 'verb' => 'GET'],
42
+        ['name' => 'lost#setPassword', 'url' => '/lostpassword/set/{token}/{userId}', 'verb' => 'POST'],
43
+        ['name' => 'user#getDisplayNames', 'url' => '/displaynames', 'verb' => 'POST'],
44
+        ['name' => 'avatar#getAvatar', 'url' => '/avatar/{userId}/{size}', 'verb' => 'GET'],
45
+        ['name' => 'avatar#deleteAvatar', 'url' => '/avatar/', 'verb' => 'DELETE'],
46
+        ['name' => 'avatar#postCroppedAvatar', 'url' => '/avatar/cropped', 'verb' => 'POST'],
47
+        ['name' => 'avatar#getTmpAvatar', 'url' => '/avatar/tmp', 'verb' => 'GET'],
48
+        ['name' => 'avatar#postAvatar', 'url' => '/avatar/', 'verb' => 'POST'],
49
+        ['name' => 'CSRFToken#index', 'url' => '/csrftoken', 'verb' => 'GET'],
50
+        ['name' => 'login#tryLogin', 'url' => '/login', 'verb' => 'POST'],
51
+        ['name' => 'login#confirmPassword', 'url' => '/login/confirm', 'verb' => 'POST'],
52
+        ['name' => 'login#showLoginForm', 'url' => '/login', 'verb' => 'GET'],
53
+        ['name' => 'login#logout', 'url' => '/logout', 'verb' => 'GET'],
54
+        ['name' => 'ClientFlowLogin#showAuthPickerPage', 'url' => '/login/flow', 'verb' => 'GET'],
55
+        ['name' => 'ClientFlowLogin#redirectPage', 'url' => '/login/flow/redirect', 'verb' => 'GET'],
56
+        ['name' => 'ClientFlowLogin#generateAppPassword', 'url' => '/login/flow', 'verb' => 'POST'],
57
+        ['name' => 'ClientFlowLogin#grantPage', 'url' => '/login/flow/grant', 'verb' => 'GET'],
58
+        ['name' => 'TwoFactorChallenge#selectChallenge', 'url' => '/login/selectchallenge', 'verb' => 'GET'],
59
+        ['name' => 'TwoFactorChallenge#showChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'GET'],
60
+        ['name' => 'TwoFactorChallenge#solveChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'POST'],
61
+        ['name' => 'OCJS#getConfig', 'url' => '/core/js/oc.js', 'verb' => 'GET'],
62
+        ['name' => 'Preview#getPreviewByFileId', 'url' => '/core/preview', 'verb' => 'GET'],
63
+        ['name' => 'Preview#getPreview', 'url' => '/core/preview.png', 'verb' => 'GET'],
64
+        ['name' => 'Css#getCss', 'url' => '/css/{appName}/{fileName}', 'verb' => 'GET'],
65
+        ['name' => 'Js#getJs', 'url' => '/js/{appName}/{fileName}', 'verb' => 'GET'],
66
+        ['name' => 'contactsMenu#index', 'url' => '/contactsmenu/contacts', 'verb' => 'POST'],
67
+        ['name' => 'contactsMenu#findOne', 'url' => '/contactsmenu/findOne', 'verb' => 'POST'],
68
+        ['name' => 'WalledGarden#get', 'url' => '/204', 'verb' => 'GET'],
69
+        ['name' => 'Search#search', 'url' => '/core/search', 'verb' => 'GET'],
70
+    ],
71
+    'ocs' => [
72
+        ['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'],
73
+        ['root' => '', 'name' => 'OCS#getConfig', 'url' => '/config', 'verb' => 'GET'],
74
+        ['root' => '/person', 'name' => 'OCS#personCheck', 'url' => '/check', 'verb' => 'POST'],
75
+        ['root' => '/identityproof', 'name' => 'OCS#getIdentityProof', 'url' => '/key/{cloudId}', 'verb' => 'GET'],
76
+        ['root' => '/core', 'name' => 'Navigation#getAppsNavigation', 'url' => '/navigation/apps', 'verb' => 'GET'],
77
+        ['root' => '/core', 'name' => 'Navigation#getSettingsNavigation', 'url' => '/navigation/settings', 'verb' => 'GET'],
78
+        ['root' => '/core', 'name' => 'AutoComplete#get', 'url' => '/autocomplete/get', 'verb' => 'GET'],
79
+    ],
80 80
 ]);
81 81
 
82 82
 // Post installation check
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
 // Core ajax actions
86 86
 // Routing
87 87
 $this->create('core_ajax_update', '/core/ajax/update.php')
88
-	->actionInclude('core/ajax/update.php');
88
+    ->actionInclude('core/ajax/update.php');
89 89
 
90 90
 // File routes
91 91
 $this->create('files.viewcontroller.showFile', '/f/{fileid}')->action(function($urlParams) {
92
-	$app = new \OCA\Files\AppInfo\Application($urlParams);
93
-	$app->dispatch('ViewController', 'index');
92
+    $app = new \OCA\Files\AppInfo\Application($urlParams);
93
+    $app->dispatch('ViewController', 'index');
94 94
 });
95 95
 
96 96
 // Call routes
@@ -99,12 +99,12 @@  discard block
 block discarded – undo
99 99
  * @suppress PhanUndeclaredClassMethod
100 100
  */
101 101
 $this->create('spreed.pagecontroller.showCall', '/call/{token}')->action(function($urlParams) {
102
-	if (class_exists(\OCA\Spreed\AppInfo\Application::class, false)) {
103
-		$app = new \OCA\Spreed\AppInfo\Application($urlParams);
104
-		$app->dispatch('PageController', 'index');
105
-	} else {
106
-		throw new \OC\HintException('App spreed is not enabled');
107
-	}
102
+    if (class_exists(\OCA\Spreed\AppInfo\Application::class, false)) {
103
+        $app = new \OCA\Spreed\AppInfo\Application($urlParams);
104
+        $app->dispatch('PageController', 'index');
105
+    } else {
106
+        throw new \OC\HintException('App spreed is not enabled');
107
+    }
108 108
 });
109 109
 
110 110
 // OCM routes
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
  * @suppress PhanUndeclaredClassMethod
114 114
  */
115 115
 $this->create('cloud_federation_api.requesthandlercontroller.addShare', '/ocm/shares')->post()->action(function($urlParams) {
116
-	if (class_exists(\OCA\CloudFederationAPI\AppInfo\Application::class, false)) {
117
-		$app = new \OCA\CloudFederationAPI\AppInfo\Application($urlParams);
118
-		$app->dispatch('RequestHandlerController', 'addShare');
119
-	} else {
120
-		throw new \OC\HintException('Cloud Federation API not enabled');
121
-	}
116
+    if (class_exists(\OCA\CloudFederationAPI\AppInfo\Application::class, false)) {
117
+        $app = new \OCA\CloudFederationAPI\AppInfo\Application($urlParams);
118
+        $app->dispatch('RequestHandlerController', 'addShare');
119
+    } else {
120
+        throw new \OC\HintException('Cloud Federation API not enabled');
121
+    }
122 122
 });
123 123
 
124 124
 /**
@@ -126,53 +126,53 @@  discard block
 block discarded – undo
126 126
  * @suppress PhanUndeclaredClassMethod
127 127
  */
128 128
 $this->create('cloud_federation_api.requesthandlercontroller.receiveNotification', '/ocm/notifications')->post()->action(function($urlParams) {
129
-	if (class_exists(\OCA\CloudFederationAPI\AppInfo\Application::class, false)) {
130
-		$app = new \OCA\CloudFederationAPI\AppInfo\Application($urlParams);
131
-		$app->dispatch('RequestHandlerController', 'receiveNotification');
132
-	} else {
133
-		throw new \OC\HintException('Cloud Federation API not enabled');
134
-	}
129
+    if (class_exists(\OCA\CloudFederationAPI\AppInfo\Application::class, false)) {
130
+        $app = new \OCA\CloudFederationAPI\AppInfo\Application($urlParams);
131
+        $app->dispatch('RequestHandlerController', 'receiveNotification');
132
+    } else {
133
+        throw new \OC\HintException('Cloud Federation API not enabled');
134
+    }
135 135
 });
136 136
 
137 137
 
138 138
 // Sharing routes
139 139
 $this->create('files_sharing.sharecontroller.showShare', '/s/{token}')->action(function($urlParams) {
140
-	if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
141
-		$app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
142
-		$app->dispatch('ShareController', 'showShare');
143
-	} else {
144
-		throw new \OC\HintException('App file sharing is not enabled');
145
-	}
140
+    if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
141
+        $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
142
+        $app->dispatch('ShareController', 'showShare');
143
+    } else {
144
+        throw new \OC\HintException('App file sharing is not enabled');
145
+    }
146 146
 });
147 147
 $this->create('files_sharing.sharecontroller.authenticate', '/s/{token}/authenticate/{redirect}')->post()->action(function($urlParams) {
148
-	if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
149
-		$app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
150
-		$app->dispatch('ShareController', 'authenticate');
151
-	} else {
152
-		throw new \OC\HintException('App file sharing is not enabled');
153
-	}
148
+    if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
149
+        $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
150
+        $app->dispatch('ShareController', 'authenticate');
151
+    } else {
152
+        throw new \OC\HintException('App file sharing is not enabled');
153
+    }
154 154
 });
155 155
 $this->create('files_sharing.sharecontroller.showAuthenticate', '/s/{token}/authenticate/{redirect}')->get()->action(function($urlParams) {
156
-	if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
157
-		$app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
158
-		$app->dispatch('ShareController', 'showAuthenticate');
159
-	} else {
160
-		throw new \OC\HintException('App file sharing is not enabled');
161
-	}
156
+    if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
157
+        $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
158
+        $app->dispatch('ShareController', 'showAuthenticate');
159
+    } else {
160
+        throw new \OC\HintException('App file sharing is not enabled');
161
+    }
162 162
 });
163 163
 $this->create('files_sharing.sharecontroller.downloadShare', '/s/{token}/download')->get()->action(function($urlParams) {
164
-	if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
165
-		$app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
166
-		$app->dispatch('ShareController', 'downloadShare');
167
-	} else {
168
-		throw new \OC\HintException('App file sharing is not enabled');
169
-	}
164
+    if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
165
+        $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
166
+        $app->dispatch('ShareController', 'downloadShare');
167
+    } else {
168
+        throw new \OC\HintException('App file sharing is not enabled');
169
+    }
170 170
 });
171 171
 $this->create('files_sharing.publicpreview.directLink', '/s/{token}/preview')->get()->action(function($urlParams) {
172
-	if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
173
-		$app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
174
-		$app->dispatch('PublicPreviewController', 'directLink');
175
-	} else {
176
-		throw new \OC\HintException('App file sharing is not enabled');
177
-	}
172
+    if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) {
173
+        $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams);
174
+        $app->dispatch('PublicPreviewController', 'directLink');
175
+    } else {
176
+        throw new \OC\HintException('App file sharing is not enabled');
177
+    }
178 178
 });
Please login to merge, or discard this patch.
lib/public/IServerContainer.php 1 patch
Indentation   +505 added lines, -505 removed lines patch added patch discarded remove patch
@@ -60,509 +60,509 @@
 block discarded – undo
60 60
  */
61 61
 interface IServerContainer extends IContainer {
62 62
 
63
-	/**
64
-	 * The calendar manager will act as a broker between consumers for calendar information and
65
-	 * providers which actual deliver the calendar information.
66
-	 *
67
-	 * @return \OCP\Calendar\IManager
68
-	 * @since 13.0.0
69
-	 */
70
-	public function getCalendarManager();
71
-
72
-	/**
73
-	 * The contacts manager will act as a broker between consumers for contacts information and
74
-	 * providers which actual deliver the contact information.
75
-	 *
76
-	 * @return \OCP\Contacts\IManager
77
-	 * @since 6.0.0
78
-	 */
79
-	public function getContactsManager();
80
-
81
-	/**
82
-	 * The current request object holding all information about the request currently being processed
83
-	 * is returned from this method.
84
-	 * In case the current execution was not initiated by a web request null is returned
85
-	 *
86
-	 * @return \OCP\IRequest
87
-	 * @since 6.0.0
88
-	 */
89
-	public function getRequest();
90
-
91
-	/**
92
-	 * Returns the preview manager which can create preview images for a given file
93
-	 *
94
-	 * @return \OCP\IPreview
95
-	 * @since 6.0.0
96
-	 */
97
-	public function getPreviewManager();
98
-
99
-	/**
100
-	 * Returns the tag manager which can get and set tags for different object types
101
-	 *
102
-	 * @see \OCP\ITagManager::load()
103
-	 * @return \OCP\ITagManager
104
-	 * @since 6.0.0
105
-	 */
106
-	public function getTagManager();
107
-
108
-	/**
109
-	 * Returns the root folder of ownCloud's data directory
110
-	 *
111
-	 * @return \OCP\Files\IRootFolder
112
-	 * @since 6.0.0 - between 6.0.0 and 8.0.0 this returned \OCP\Files\Folder
113
-	 */
114
-	public function getRootFolder();
115
-
116
-	/**
117
-	 * Returns a view to ownCloud's files folder
118
-	 *
119
-	 * @param string $userId user ID
120
-	 * @return \OCP\Files\Folder
121
-	 * @since 6.0.0 - parameter $userId was added in 8.0.0
122
-	 * @see getUserFolder in \OCP\Files\IRootFolder
123
-	 */
124
-	public function getUserFolder($userId = null);
125
-
126
-	/**
127
-	 * Returns an app-specific view in ownClouds data directory
128
-	 *
129
-	 * @return \OCP\Files\Folder
130
-	 * @since 6.0.0
131
-	 * @deprecated 9.2.0 use IAppData
132
-	 */
133
-	public function getAppFolder();
134
-
135
-	/**
136
-	 * Returns a user manager
137
-	 *
138
-	 * @return \OCP\IUserManager
139
-	 * @since 8.0.0
140
-	 */
141
-	public function getUserManager();
142
-
143
-	/**
144
-	 * Returns a group manager
145
-	 *
146
-	 * @return \OCP\IGroupManager
147
-	 * @since 8.0.0
148
-	 */
149
-	public function getGroupManager();
150
-
151
-	/**
152
-	 * Returns the user session
153
-	 *
154
-	 * @return \OCP\IUserSession
155
-	 * @since 6.0.0
156
-	 */
157
-	public function getUserSession();
158
-
159
-	/**
160
-	 * Returns the navigation manager
161
-	 *
162
-	 * @return \OCP\INavigationManager
163
-	 * @since 6.0.0
164
-	 */
165
-	public function getNavigationManager();
166
-
167
-	/**
168
-	 * Returns the config manager
169
-	 *
170
-	 * @return \OCP\IConfig
171
-	 * @since 6.0.0
172
-	 */
173
-	public function getConfig();
174
-
175
-	/**
176
-	 * Returns a Crypto instance
177
-	 *
178
-	 * @return \OCP\Security\ICrypto
179
-	 * @since 8.0.0
180
-	 */
181
-	public function getCrypto();
182
-
183
-	/**
184
-	 * Returns a Hasher instance
185
-	 *
186
-	 * @return \OCP\Security\IHasher
187
-	 * @since 8.0.0
188
-	 */
189
-	public function getHasher();
190
-
191
-	/**
192
-	 * Returns a SecureRandom instance
193
-	 *
194
-	 * @return \OCP\Security\ISecureRandom
195
-	 * @since 8.1.0
196
-	 */
197
-	public function getSecureRandom();
198
-
199
-	/**
200
-	 * Returns a CredentialsManager instance
201
-	 *
202
-	 * @return \OCP\Security\ICredentialsManager
203
-	 * @since 9.0.0
204
-	 */
205
-	public function getCredentialsManager();
206
-
207
-	/**
208
-	 * Returns the app config manager
209
-	 *
210
-	 * @return \OCP\IAppConfig
211
-	 * @since 7.0.0
212
-	 */
213
-	public function getAppConfig();
214
-
215
-	/**
216
-	 * @return \OCP\L10N\IFactory
217
-	 * @since 8.2.0
218
-	 */
219
-	public function getL10NFactory();
220
-
221
-	/**
222
-	 * get an L10N instance
223
-	 * @param string $app appid
224
-	 * @param string $lang
225
-	 * @return \OCP\IL10N
226
-	 * @since 6.0.0 - parameter $lang was added in 8.0.0
227
-	 */
228
-	public function getL10N($app, $lang = null);
229
-
230
-	/**
231
-	 * @return \OC\Encryption\Manager
232
-	 * @since 8.1.0
233
-	 */
234
-	public function getEncryptionManager();
235
-
236
-	/**
237
-	 * @return \OC\Encryption\File
238
-	 * @since 8.1.0
239
-	 */
240
-	public function getEncryptionFilesHelper();
241
-
242
-	/**
243
-	 * @return \OCP\Encryption\Keys\IStorage
244
-	 * @since 8.1.0
245
-	 */
246
-	public function getEncryptionKeyStorage();
247
-
248
-	/**
249
-	 * Returns the URL generator
250
-	 *
251
-	 * @return \OCP\IURLGenerator
252
-	 * @since 6.0.0
253
-	 */
254
-	public function getURLGenerator();
255
-
256
-	/**
257
-	 * Returns an ICache instance
258
-	 *
259
-	 * @return \OCP\ICache
260
-	 * @since 6.0.0
261
-	 */
262
-	public function getCache();
263
-
264
-	/**
265
-	 * Returns an \OCP\CacheFactory instance
266
-	 *
267
-	 * @return \OCP\ICacheFactory
268
-	 * @since 7.0.0
269
-	 */
270
-	public function getMemCacheFactory();
271
-
272
-	/**
273
-	 * Returns the current session
274
-	 *
275
-	 * @return \OCP\ISession
276
-	 * @since 6.0.0
277
-	 */
278
-	public function getSession();
279
-
280
-	/**
281
-	 * Returns the activity manager
282
-	 *
283
-	 * @return \OCP\Activity\IManager
284
-	 * @since 6.0.0
285
-	 */
286
-	public function getActivityManager();
287
-
288
-	/**
289
-	 * Returns the current session
290
-	 *
291
-	 * @return \OCP\IDBConnection
292
-	 * @since 6.0.0
293
-	 */
294
-	public function getDatabaseConnection();
295
-
296
-	/**
297
-	 * Returns an avatar manager, used for avatar functionality
298
-	 *
299
-	 * @return \OCP\IAvatarManager
300
-	 * @since 6.0.0
301
-	 */
302
-	public function getAvatarManager();
303
-
304
-	/**
305
-	 * Returns an job list for controlling background jobs
306
-	 *
307
-	 * @return \OCP\BackgroundJob\IJobList
308
-	 * @since 7.0.0
309
-	 */
310
-	public function getJobList();
311
-
312
-	/**
313
-	 * Returns a logger instance
314
-	 *
315
-	 * @return \OCP\ILogger
316
-	 * @since 8.0.0
317
-	 */
318
-	public function getLogger();
319
-
320
-	/**
321
-	 * returns a log factory instance
322
-	 *
323
-	 * @return ILogFactory
324
-	 * @since 14.0.0
325
-	 */
326
-	public function getLogFactory();
327
-
328
-	/**
329
-	 * Returns a router for generating and matching urls
330
-	 *
331
-	 * @return \OCP\Route\IRouter
332
-	 * @since 7.0.0
333
-	 */
334
-	public function getRouter();
335
-
336
-	/**
337
-	 * Returns a search instance
338
-	 *
339
-	 * @return \OCP\ISearch
340
-	 * @since 7.0.0
341
-	 */
342
-	public function getSearch();
343
-
344
-	/**
345
-	 * Get the certificate manager for the user
346
-	 *
347
-	 * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager
348
-	 * @return \OCP\ICertificateManager | null if $userId is null and no user is logged in
349
-	 * @since 8.0.0
350
-	 */
351
-	public function getCertificateManager($userId = null);
352
-
353
-	/**
354
-	 * Create a new event source
355
-	 *
356
-	 * @return \OCP\IEventSource
357
-	 * @since 8.0.0
358
-	 */
359
-	public function createEventSource();
360
-
361
-	/**
362
-	 * Returns an instance of the HTTP client service
363
-	 *
364
-	 * @return \OCP\Http\Client\IClientService
365
-	 * @since 8.1.0
366
-	 */
367
-	public function getHTTPClientService();
368
-
369
-	/**
370
-	 * Get the active event logger
371
-	 *
372
-	 * @return \OCP\Diagnostics\IEventLogger
373
-	 * @since 8.0.0
374
-	 */
375
-	public function getEventLogger();
376
-
377
-	/**
378
-	 * Get the active query logger
379
-	 *
380
-	 * The returned logger only logs data when debug mode is enabled
381
-	 *
382
-	 * @return \OCP\Diagnostics\IQueryLogger
383
-	 * @since 8.0.0
384
-	 */
385
-	public function getQueryLogger();
386
-
387
-	/**
388
-	 * Get the manager for temporary files and folders
389
-	 *
390
-	 * @return \OCP\ITempManager
391
-	 * @since 8.0.0
392
-	 */
393
-	public function getTempManager();
394
-
395
-	/**
396
-	 * Get the app manager
397
-	 *
398
-	 * @return \OCP\App\IAppManager
399
-	 * @since 8.0.0
400
-	 */
401
-	public function getAppManager();
402
-
403
-	/**
404
-	 * Get the webroot
405
-	 *
406
-	 * @return string
407
-	 * @since 8.0.0
408
-	 */
409
-	public function getWebRoot();
410
-
411
-	/**
412
-	 * @return \OCP\Files\Config\IMountProviderCollection
413
-	 * @since 8.0.0
414
-	 */
415
-	public function getMountProviderCollection();
416
-
417
-	/**
418
-	 * Get the IniWrapper
419
-	 *
420
-	 * @return \bantu\IniGetWrapper\IniGetWrapper
421
-	 * @since 8.0.0
422
-	 */
423
-	public function getIniWrapper();
424
-	/**
425
-	 * @return \OCP\Command\IBus
426
-	 * @since 8.1.0
427
-	 */
428
-	public function getCommandBus();
429
-
430
-	/**
431
-	 * Creates a new mailer
432
-	 *
433
-	 * @return \OCP\Mail\IMailer
434
-	 * @since 8.1.0
435
-	 */
436
-	public function getMailer();
437
-
438
-	/**
439
-	 * Get the locking provider
440
-	 *
441
-	 * @return \OCP\Lock\ILockingProvider
442
-	 * @since 8.1.0
443
-	 */
444
-	public function getLockingProvider();
445
-
446
-	/**
447
-	 * @return \OCP\Files\Mount\IMountManager
448
-	 * @since 8.2.0
449
-	 */
450
-	public function getMountManager();
451
-
452
-	/**
453
-	 * Get the MimeTypeDetector
454
-	 *
455
-	 * @return \OCP\Files\IMimeTypeDetector
456
-	 * @since 8.2.0
457
-	 */
458
-	public function getMimeTypeDetector();
459
-
460
-	/**
461
-	 * Get the MimeTypeLoader
462
-	 *
463
-	 * @return \OCP\Files\IMimeTypeLoader
464
-	 * @since 8.2.0
465
-	 */
466
-	public function getMimeTypeLoader();
467
-
468
-	/**
469
-	 * Get the EventDispatcher
470
-	 *
471
-	 * @return EventDispatcherInterface
472
-	 * @since 8.2.0
473
-	 */
474
-	public function getEventDispatcher();
475
-
476
-	/**
477
-	 * Get the Notification Manager
478
-	 *
479
-	 * @return \OCP\Notification\IManager
480
-	 * @since 9.0.0
481
-	 */
482
-	public function getNotificationManager();
483
-
484
-	/**
485
-	 * @return \OCP\Comments\ICommentsManager
486
-	 * @since 9.0.0
487
-	 */
488
-	public function getCommentsManager();
489
-
490
-	/**
491
-	 * Returns the system-tag manager
492
-	 *
493
-	 * @return \OCP\SystemTag\ISystemTagManager
494
-	 *
495
-	 * @since 9.0.0
496
-	 */
497
-	public function getSystemTagManager();
498
-
499
-	/**
500
-	 * Returns the system-tag object mapper
501
-	 *
502
-	 * @return \OCP\SystemTag\ISystemTagObjectMapper
503
-	 *
504
-	 * @since 9.0.0
505
-	 */
506
-	public function getSystemTagObjectMapper();
507
-
508
-	/**
509
-	 * Returns the share manager
510
-	 *
511
-	 * @return \OCP\Share\IManager
512
-	 * @since 9.0.0
513
-	 */
514
-	public function getShareManager();
515
-
516
-	/**
517
-	 * @return IContentSecurityPolicyManager
518
-	 * @since 9.0.0
519
-	 */
520
-	public function getContentSecurityPolicyManager();
521
-
522
-	/**
523
-	 * @return \OCP\IDateTimeZone
524
-	 * @since 8.0.0
525
-	 */
526
-	public function getDateTimeZone();
527
-
528
-	/**
529
-	 * @return \OCP\IDateTimeFormatter
530
-	 * @since 8.0.0
531
-	 */
532
-	public function getDateTimeFormatter();
533
-
534
-	/**
535
-	 * @return \OCP\Federation\ICloudIdManager
536
-	 * @since 12.0.0
537
-	 */
538
-	public function getCloudIdManager();
539
-
540
-	/**
541
-	 * @return \OCP\GlobalScale\IConfig
542
-	 */
543
-	public function getGlobalScaleConfig();
544
-
545
-	/**
546
-	 * @return ICloudFederationFactory
547
-	 * @since 14.0.0
548
-	 */
549
-	public function getCloudFederationFactory();
550
-
551
-	/**
552
-	 * @return ICloudFederationProviderManager
553
-	 * @since 14.0.0
554
-	 */
555
-	public function getCloudFederationProviderManager();
556
-
557
-	/**
558
-	 * @return \OCP\Remote\Api\IApiFactory
559
-	 * @since 13.0.0
560
-	 */
561
-	public function getRemoteApiFactory();
562
-
563
-	/**
564
-	 * @return \OCP\Remote\IInstanceFactory
565
-	 * @since 13.0.0
566
-	 */
567
-	public function getRemoteInstanceFactory();
63
+    /**
64
+     * The calendar manager will act as a broker between consumers for calendar information and
65
+     * providers which actual deliver the calendar information.
66
+     *
67
+     * @return \OCP\Calendar\IManager
68
+     * @since 13.0.0
69
+     */
70
+    public function getCalendarManager();
71
+
72
+    /**
73
+     * The contacts manager will act as a broker between consumers for contacts information and
74
+     * providers which actual deliver the contact information.
75
+     *
76
+     * @return \OCP\Contacts\IManager
77
+     * @since 6.0.0
78
+     */
79
+    public function getContactsManager();
80
+
81
+    /**
82
+     * The current request object holding all information about the request currently being processed
83
+     * is returned from this method.
84
+     * In case the current execution was not initiated by a web request null is returned
85
+     *
86
+     * @return \OCP\IRequest
87
+     * @since 6.0.0
88
+     */
89
+    public function getRequest();
90
+
91
+    /**
92
+     * Returns the preview manager which can create preview images for a given file
93
+     *
94
+     * @return \OCP\IPreview
95
+     * @since 6.0.0
96
+     */
97
+    public function getPreviewManager();
98
+
99
+    /**
100
+     * Returns the tag manager which can get and set tags for different object types
101
+     *
102
+     * @see \OCP\ITagManager::load()
103
+     * @return \OCP\ITagManager
104
+     * @since 6.0.0
105
+     */
106
+    public function getTagManager();
107
+
108
+    /**
109
+     * Returns the root folder of ownCloud's data directory
110
+     *
111
+     * @return \OCP\Files\IRootFolder
112
+     * @since 6.0.0 - between 6.0.0 and 8.0.0 this returned \OCP\Files\Folder
113
+     */
114
+    public function getRootFolder();
115
+
116
+    /**
117
+     * Returns a view to ownCloud's files folder
118
+     *
119
+     * @param string $userId user ID
120
+     * @return \OCP\Files\Folder
121
+     * @since 6.0.0 - parameter $userId was added in 8.0.0
122
+     * @see getUserFolder in \OCP\Files\IRootFolder
123
+     */
124
+    public function getUserFolder($userId = null);
125
+
126
+    /**
127
+     * Returns an app-specific view in ownClouds data directory
128
+     *
129
+     * @return \OCP\Files\Folder
130
+     * @since 6.0.0
131
+     * @deprecated 9.2.0 use IAppData
132
+     */
133
+    public function getAppFolder();
134
+
135
+    /**
136
+     * Returns a user manager
137
+     *
138
+     * @return \OCP\IUserManager
139
+     * @since 8.0.0
140
+     */
141
+    public function getUserManager();
142
+
143
+    /**
144
+     * Returns a group manager
145
+     *
146
+     * @return \OCP\IGroupManager
147
+     * @since 8.0.0
148
+     */
149
+    public function getGroupManager();
150
+
151
+    /**
152
+     * Returns the user session
153
+     *
154
+     * @return \OCP\IUserSession
155
+     * @since 6.0.0
156
+     */
157
+    public function getUserSession();
158
+
159
+    /**
160
+     * Returns the navigation manager
161
+     *
162
+     * @return \OCP\INavigationManager
163
+     * @since 6.0.0
164
+     */
165
+    public function getNavigationManager();
166
+
167
+    /**
168
+     * Returns the config manager
169
+     *
170
+     * @return \OCP\IConfig
171
+     * @since 6.0.0
172
+     */
173
+    public function getConfig();
174
+
175
+    /**
176
+     * Returns a Crypto instance
177
+     *
178
+     * @return \OCP\Security\ICrypto
179
+     * @since 8.0.0
180
+     */
181
+    public function getCrypto();
182
+
183
+    /**
184
+     * Returns a Hasher instance
185
+     *
186
+     * @return \OCP\Security\IHasher
187
+     * @since 8.0.0
188
+     */
189
+    public function getHasher();
190
+
191
+    /**
192
+     * Returns a SecureRandom instance
193
+     *
194
+     * @return \OCP\Security\ISecureRandom
195
+     * @since 8.1.0
196
+     */
197
+    public function getSecureRandom();
198
+
199
+    /**
200
+     * Returns a CredentialsManager instance
201
+     *
202
+     * @return \OCP\Security\ICredentialsManager
203
+     * @since 9.0.0
204
+     */
205
+    public function getCredentialsManager();
206
+
207
+    /**
208
+     * Returns the app config manager
209
+     *
210
+     * @return \OCP\IAppConfig
211
+     * @since 7.0.0
212
+     */
213
+    public function getAppConfig();
214
+
215
+    /**
216
+     * @return \OCP\L10N\IFactory
217
+     * @since 8.2.0
218
+     */
219
+    public function getL10NFactory();
220
+
221
+    /**
222
+     * get an L10N instance
223
+     * @param string $app appid
224
+     * @param string $lang
225
+     * @return \OCP\IL10N
226
+     * @since 6.0.0 - parameter $lang was added in 8.0.0
227
+     */
228
+    public function getL10N($app, $lang = null);
229
+
230
+    /**
231
+     * @return \OC\Encryption\Manager
232
+     * @since 8.1.0
233
+     */
234
+    public function getEncryptionManager();
235
+
236
+    /**
237
+     * @return \OC\Encryption\File
238
+     * @since 8.1.0
239
+     */
240
+    public function getEncryptionFilesHelper();
241
+
242
+    /**
243
+     * @return \OCP\Encryption\Keys\IStorage
244
+     * @since 8.1.0
245
+     */
246
+    public function getEncryptionKeyStorage();
247
+
248
+    /**
249
+     * Returns the URL generator
250
+     *
251
+     * @return \OCP\IURLGenerator
252
+     * @since 6.0.0
253
+     */
254
+    public function getURLGenerator();
255
+
256
+    /**
257
+     * Returns an ICache instance
258
+     *
259
+     * @return \OCP\ICache
260
+     * @since 6.0.0
261
+     */
262
+    public function getCache();
263
+
264
+    /**
265
+     * Returns an \OCP\CacheFactory instance
266
+     *
267
+     * @return \OCP\ICacheFactory
268
+     * @since 7.0.0
269
+     */
270
+    public function getMemCacheFactory();
271
+
272
+    /**
273
+     * Returns the current session
274
+     *
275
+     * @return \OCP\ISession
276
+     * @since 6.0.0
277
+     */
278
+    public function getSession();
279
+
280
+    /**
281
+     * Returns the activity manager
282
+     *
283
+     * @return \OCP\Activity\IManager
284
+     * @since 6.0.0
285
+     */
286
+    public function getActivityManager();
287
+
288
+    /**
289
+     * Returns the current session
290
+     *
291
+     * @return \OCP\IDBConnection
292
+     * @since 6.0.0
293
+     */
294
+    public function getDatabaseConnection();
295
+
296
+    /**
297
+     * Returns an avatar manager, used for avatar functionality
298
+     *
299
+     * @return \OCP\IAvatarManager
300
+     * @since 6.0.0
301
+     */
302
+    public function getAvatarManager();
303
+
304
+    /**
305
+     * Returns an job list for controlling background jobs
306
+     *
307
+     * @return \OCP\BackgroundJob\IJobList
308
+     * @since 7.0.0
309
+     */
310
+    public function getJobList();
311
+
312
+    /**
313
+     * Returns a logger instance
314
+     *
315
+     * @return \OCP\ILogger
316
+     * @since 8.0.0
317
+     */
318
+    public function getLogger();
319
+
320
+    /**
321
+     * returns a log factory instance
322
+     *
323
+     * @return ILogFactory
324
+     * @since 14.0.0
325
+     */
326
+    public function getLogFactory();
327
+
328
+    /**
329
+     * Returns a router for generating and matching urls
330
+     *
331
+     * @return \OCP\Route\IRouter
332
+     * @since 7.0.0
333
+     */
334
+    public function getRouter();
335
+
336
+    /**
337
+     * Returns a search instance
338
+     *
339
+     * @return \OCP\ISearch
340
+     * @since 7.0.0
341
+     */
342
+    public function getSearch();
343
+
344
+    /**
345
+     * Get the certificate manager for the user
346
+     *
347
+     * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager
348
+     * @return \OCP\ICertificateManager | null if $userId is null and no user is logged in
349
+     * @since 8.0.0
350
+     */
351
+    public function getCertificateManager($userId = null);
352
+
353
+    /**
354
+     * Create a new event source
355
+     *
356
+     * @return \OCP\IEventSource
357
+     * @since 8.0.0
358
+     */
359
+    public function createEventSource();
360
+
361
+    /**
362
+     * Returns an instance of the HTTP client service
363
+     *
364
+     * @return \OCP\Http\Client\IClientService
365
+     * @since 8.1.0
366
+     */
367
+    public function getHTTPClientService();
368
+
369
+    /**
370
+     * Get the active event logger
371
+     *
372
+     * @return \OCP\Diagnostics\IEventLogger
373
+     * @since 8.0.0
374
+     */
375
+    public function getEventLogger();
376
+
377
+    /**
378
+     * Get the active query logger
379
+     *
380
+     * The returned logger only logs data when debug mode is enabled
381
+     *
382
+     * @return \OCP\Diagnostics\IQueryLogger
383
+     * @since 8.0.0
384
+     */
385
+    public function getQueryLogger();
386
+
387
+    /**
388
+     * Get the manager for temporary files and folders
389
+     *
390
+     * @return \OCP\ITempManager
391
+     * @since 8.0.0
392
+     */
393
+    public function getTempManager();
394
+
395
+    /**
396
+     * Get the app manager
397
+     *
398
+     * @return \OCP\App\IAppManager
399
+     * @since 8.0.0
400
+     */
401
+    public function getAppManager();
402
+
403
+    /**
404
+     * Get the webroot
405
+     *
406
+     * @return string
407
+     * @since 8.0.0
408
+     */
409
+    public function getWebRoot();
410
+
411
+    /**
412
+     * @return \OCP\Files\Config\IMountProviderCollection
413
+     * @since 8.0.0
414
+     */
415
+    public function getMountProviderCollection();
416
+
417
+    /**
418
+     * Get the IniWrapper
419
+     *
420
+     * @return \bantu\IniGetWrapper\IniGetWrapper
421
+     * @since 8.0.0
422
+     */
423
+    public function getIniWrapper();
424
+    /**
425
+     * @return \OCP\Command\IBus
426
+     * @since 8.1.0
427
+     */
428
+    public function getCommandBus();
429
+
430
+    /**
431
+     * Creates a new mailer
432
+     *
433
+     * @return \OCP\Mail\IMailer
434
+     * @since 8.1.0
435
+     */
436
+    public function getMailer();
437
+
438
+    /**
439
+     * Get the locking provider
440
+     *
441
+     * @return \OCP\Lock\ILockingProvider
442
+     * @since 8.1.0
443
+     */
444
+    public function getLockingProvider();
445
+
446
+    /**
447
+     * @return \OCP\Files\Mount\IMountManager
448
+     * @since 8.2.0
449
+     */
450
+    public function getMountManager();
451
+
452
+    /**
453
+     * Get the MimeTypeDetector
454
+     *
455
+     * @return \OCP\Files\IMimeTypeDetector
456
+     * @since 8.2.0
457
+     */
458
+    public function getMimeTypeDetector();
459
+
460
+    /**
461
+     * Get the MimeTypeLoader
462
+     *
463
+     * @return \OCP\Files\IMimeTypeLoader
464
+     * @since 8.2.0
465
+     */
466
+    public function getMimeTypeLoader();
467
+
468
+    /**
469
+     * Get the EventDispatcher
470
+     *
471
+     * @return EventDispatcherInterface
472
+     * @since 8.2.0
473
+     */
474
+    public function getEventDispatcher();
475
+
476
+    /**
477
+     * Get the Notification Manager
478
+     *
479
+     * @return \OCP\Notification\IManager
480
+     * @since 9.0.0
481
+     */
482
+    public function getNotificationManager();
483
+
484
+    /**
485
+     * @return \OCP\Comments\ICommentsManager
486
+     * @since 9.0.0
487
+     */
488
+    public function getCommentsManager();
489
+
490
+    /**
491
+     * Returns the system-tag manager
492
+     *
493
+     * @return \OCP\SystemTag\ISystemTagManager
494
+     *
495
+     * @since 9.0.0
496
+     */
497
+    public function getSystemTagManager();
498
+
499
+    /**
500
+     * Returns the system-tag object mapper
501
+     *
502
+     * @return \OCP\SystemTag\ISystemTagObjectMapper
503
+     *
504
+     * @since 9.0.0
505
+     */
506
+    public function getSystemTagObjectMapper();
507
+
508
+    /**
509
+     * Returns the share manager
510
+     *
511
+     * @return \OCP\Share\IManager
512
+     * @since 9.0.0
513
+     */
514
+    public function getShareManager();
515
+
516
+    /**
517
+     * @return IContentSecurityPolicyManager
518
+     * @since 9.0.0
519
+     */
520
+    public function getContentSecurityPolicyManager();
521
+
522
+    /**
523
+     * @return \OCP\IDateTimeZone
524
+     * @since 8.0.0
525
+     */
526
+    public function getDateTimeZone();
527
+
528
+    /**
529
+     * @return \OCP\IDateTimeFormatter
530
+     * @since 8.0.0
531
+     */
532
+    public function getDateTimeFormatter();
533
+
534
+    /**
535
+     * @return \OCP\Federation\ICloudIdManager
536
+     * @since 12.0.0
537
+     */
538
+    public function getCloudIdManager();
539
+
540
+    /**
541
+     * @return \OCP\GlobalScale\IConfig
542
+     */
543
+    public function getGlobalScaleConfig();
544
+
545
+    /**
546
+     * @return ICloudFederationFactory
547
+     * @since 14.0.0
548
+     */
549
+    public function getCloudFederationFactory();
550
+
551
+    /**
552
+     * @return ICloudFederationProviderManager
553
+     * @since 14.0.0
554
+     */
555
+    public function getCloudFederationProviderManager();
556
+
557
+    /**
558
+     * @return \OCP\Remote\Api\IApiFactory
559
+     * @since 13.0.0
560
+     */
561
+    public function getRemoteApiFactory();
562
+
563
+    /**
564
+     * @return \OCP\Remote\IInstanceFactory
565
+     * @since 13.0.0
566
+     */
567
+    public function getRemoteInstanceFactory();
568 568
 }
Please login to merge, or discard this patch.