|
@@ -187,7 +187,7 @@ discard block |
|
|
block discarded – undo |
|
187
|
187
|
// for backward compatibility make sure that the remote url stored in the |
|
188
|
188
|
// database ends with a trailing slash |
|
189
|
189
|
if (substr($remote, -1) !== '/') { |
|
190
|
|
- $remote = $remote . '/'; |
|
|
190
|
+ $remote = $remote.'/'; |
|
191
|
191
|
} |
|
192
|
192
|
|
|
193
|
193
|
$token = $share->getShareSecret(); |
|
@@ -214,23 +214,23 @@ discard block |
|
|
block discarded – undo |
|
214
|
214
|
|
|
215
|
215
|
// FIXME this should be a method in the user management instead |
|
216
|
216
|
if ($shareType === IShare::TYPE_USER) { |
|
217
|
|
- $this->logger->debug('shareWith before, ' . $shareWith, ['app' => 'files_sharing']); |
|
|
217
|
+ $this->logger->debug('shareWith before, '.$shareWith, ['app' => 'files_sharing']); |
|
218
|
218
|
Util::emitHook( |
|
219
|
219
|
'\OCA\Files_Sharing\API\Server2Server', |
|
220
|
220
|
'preLoginNameUsedAsUserName', |
|
221
|
221
|
['uid' => &$shareWith] |
|
222
|
222
|
); |
|
223
|
|
- $this->logger->debug('shareWith after, ' . $shareWith, ['app' => 'files_sharing']); |
|
|
223
|
+ $this->logger->debug('shareWith after, '.$shareWith, ['app' => 'files_sharing']); |
|
224
|
224
|
|
|
225
|
225
|
if (!$this->userManager->userExists($shareWith)) { |
|
226
|
|
- throw new ProviderCouldNotAddShareException('User does not exists', '',Http::STATUS_BAD_REQUEST); |
|
|
226
|
+ throw new ProviderCouldNotAddShareException('User does not exists', '', Http::STATUS_BAD_REQUEST); |
|
227
|
227
|
} |
|
228
|
228
|
|
|
229
|
229
|
\OC_Util::setupFS($shareWith); |
|
230
|
230
|
} |
|
231
|
231
|
|
|
232
|
232
|
if ($shareType === IShare::TYPE_GROUP && !$this->groupManager->groupExists($shareWith)) { |
|
233
|
|
- throw new ProviderCouldNotAddShareException('Group does not exists', '',Http::STATUS_BAD_REQUEST); |
|
|
233
|
+ throw new ProviderCouldNotAddShareException('Group does not exists', '', Http::STATUS_BAD_REQUEST); |
|
234
|
234
|
} |
|
235
|
235
|
|
|
236
|
236
|
$externalManager = new \OCA\Files_Sharing\External\Manager( |
|
@@ -249,7 +249,7 @@ discard block |
|
|
block discarded – undo |
|
249
|
249
|
); |
|
250
|
250
|
|
|
251
|
251
|
try { |
|
252
|
|
- $externalManager->addShare($remote, $token, '', $name, $owner, $shareType,false, $shareWith, $remoteId); |
|
|
252
|
+ $externalManager->addShare($remote, $token, '', $name, $owner, $shareType, false, $shareWith, $remoteId); |
|
253
|
253
|
$shareId = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share_external'); |
|
254
|
254
|
|
|
255
|
255
|
if ($shareType === IShare::TYPE_USER) { |
|
@@ -281,7 +281,7 @@ discard block |
|
|
block discarded – undo |
|
281
|
281
|
'level' => ILogger::ERROR, |
|
282
|
282
|
'app' => 'files_sharing' |
|
283
|
283
|
]); |
|
284
|
|
- throw new ProviderCouldNotAddShareException('internal server error, was not able to add share from ' . $remote, '', HTTP::STATUS_INTERNAL_SERVER_ERROR); |
|
|
284
|
+ throw new ProviderCouldNotAddShareException('internal server error, was not able to add share from '.$remote, '', HTTP::STATUS_INTERNAL_SERVER_ERROR); |
|
285
|
285
|
} |
|
286
|
286
|
} |
|
287
|
287
|
|
|
@@ -347,12 +347,12 @@ discard block |
|
|
block discarded – undo |
|
347
|
347
|
|
|
348
|
348
|
$declineAction = $notification->createAction(); |
|
349
|
349
|
$declineAction->setLabel('decline') |
|
350
|
|
- ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'DELETE'); |
|
|
350
|
+ ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/'.$shareId)), 'DELETE'); |
|
351
|
351
|
$notification->addAction($declineAction); |
|
352
|
352
|
|
|
353
|
353
|
$acceptAction = $notification->createAction(); |
|
354
|
354
|
$acceptAction->setLabel('accept') |
|
355
|
|
- ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'POST'); |
|
|
355
|
+ ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/'.$shareId)), 'POST'); |
|
356
|
356
|
$notification->addAction($acceptAction); |
|
357
|
357
|
|
|
358
|
358
|
$this->notificationManager->notify($notification); |
|
@@ -410,7 +410,7 @@ discard block |
|
|
block discarded – undo |
|
410
|
410
|
*/ |
|
411
|
411
|
protected function executeAcceptShare(IShare $share) { |
|
412
|
412
|
try { |
|
413
|
|
- $fileId = (int)$share->getNode()->getId(); |
|
|
413
|
+ $fileId = (int) $share->getNode()->getId(); |
|
414
|
414
|
[$file, $link] = $this->getFile($this->getCorrectUid($share), $fileId); |
|
415
|
415
|
} catch (\Exception $e) { |
|
416
|
416
|
throw new ShareNotFound(); |
|
@@ -486,7 +486,7 @@ discard block |
|
|
block discarded – undo |
|
486
|
486
|
$this->federatedShareProvider->removeShareFromTable($share); |
|
487
|
487
|
|
|
488
|
488
|
try { |
|
489
|
|
- $fileId = (int)$share->getNode()->getId(); |
|
|
489
|
+ $fileId = (int) $share->getNode()->getId(); |
|
490
|
490
|
[$file, $link] = $this->getFile($this->getCorrectUid($share), $fileId); |
|
491
|
491
|
} catch (\Exception $e) { |
|
492
|
492
|
throw new ShareNotFound(); |
|
@@ -578,10 +578,10 @@ discard block |
|
|
block discarded – undo |
|
578
|
578
|
// delete all child in case of a group share |
|
579
|
579
|
$qb = $this->connection->getQueryBuilder(); |
|
580
|
580
|
$qb->delete('share_external') |
|
581
|
|
- ->where($qb->expr()->eq('parent', $qb->createNamedParameter((int)$share['id']))); |
|
|
581
|
+ ->where($qb->expr()->eq('parent', $qb->createNamedParameter((int) $share['id']))); |
|
582
|
582
|
$qb->execute(); |
|
583
|
583
|
|
|
584
|
|
- if ((int)$share['share_type'] === IShare::TYPE_USER) { |
|
|
584
|
+ if ((int) $share['share_type'] === IShare::TYPE_USER) { |
|
585
|
585
|
if ($share['accepted']) { |
|
586
|
586
|
$path = trim($mountpoint, '/'); |
|
587
|
587
|
} else { |
|
@@ -590,7 +590,7 @@ discard block |
|
|
block discarded – undo |
|
590
|
590
|
$notification = $this->notificationManager->createNotification(); |
|
591
|
591
|
$notification->setApp('files_sharing') |
|
592
|
592
|
->setUser($share['user']) |
|
593
|
|
- ->setObject('remote_share', (int)$share['id']); |
|
|
593
|
+ ->setObject('remote_share', (int) $share['id']); |
|
594
|
594
|
$this->notificationManager->markProcessed($notification); |
|
595
|
595
|
|
|
596
|
596
|
$event = $this->activityManager->generateEvent(); |
|
@@ -598,7 +598,7 @@ discard block |
|
|
block discarded – undo |
|
598
|
598
|
->setType('remote_share') |
|
599
|
599
|
->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_UNSHARED, [$owner->getId(), $path]) |
|
600
|
600
|
->setAffectedUser($user) |
|
601
|
|
- ->setObject('remote_share', (int)$share['id'], $path); |
|
|
601
|
+ ->setObject('remote_share', (int) $share['id'], $path); |
|
602
|
602
|
\OC::$server->getActivityManager()->publish($event); |
|
603
|
603
|
} |
|
604
|
604
|
} |
|
@@ -646,7 +646,7 @@ discard block |
|
|
block discarded – undo |
|
646
|
646
|
$owner = $share->getShareOwner(); |
|
647
|
647
|
$currentServer = $this->addressHandler->generateRemoteURL(); |
|
648
|
648
|
if ($this->addressHandler->compareAddresses($user, $remote, $owner, $currentServer)) { |
|
649
|
|
- throw new ProviderCouldNotAddShareException('Resharing back to the owner is not allowed: ' . $id); |
|
|
649
|
+ throw new ProviderCouldNotAddShareException('Resharing back to the owner is not allowed: '.$id); |
|
650
|
650
|
} |
|
651
|
651
|
} catch (\Exception $e) { |
|
652
|
652
|
throw new ProviderCouldNotAddShareException($e->getMessage()); |
|
@@ -660,10 +660,10 @@ discard block |
|
|
block discarded – undo |
|
660
|
660
|
$share->setSharedBy($share->getSharedWith()); |
|
661
|
661
|
$share->setSharedWith($shareWith); |
|
662
|
662
|
$result = $this->federatedShareProvider->create($share); |
|
663
|
|
- $this->federatedShareProvider->storeRemoteId((int)$result->getId(), $senderId); |
|
|
663
|
+ $this->federatedShareProvider->storeRemoteId((int) $result->getId(), $senderId); |
|
664
|
664
|
return ['token' => $result->getToken(), 'providerId' => $result->getId()]; |
|
665
|
665
|
} else { |
|
666
|
|
- throw new ProviderCouldNotAddShareException('resharing not allowed for share: ' . $id); |
|
|
666
|
+ throw new ProviderCouldNotAddShareException('resharing not allowed for share: '.$id); |
|
667
|
667
|
} |
|
668
|
668
|
} |
|
669
|
669
|
|