aboutsummaryrefslogtreecommitdiffstats
path: root/apps/federatedfilesharing/lib
diff options
context:
space:
mode:
Diffstat (limited to 'apps/federatedfilesharing/lib')
-rw-r--r--apps/federatedfilesharing/lib/AddressHandler.php4
-rw-r--r--apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php16
-rw-r--r--apps/federatedfilesharing/lib/Controller/RequestHandlerController.php10
-rw-r--r--apps/federatedfilesharing/lib/FederatedShareProvider.php4
-rw-r--r--apps/federatedfilesharing/lib/Notifications.php8
-rw-r--r--apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php10
-rw-r--r--apps/federatedfilesharing/lib/Settings/Admin.php1
-rw-r--r--apps/federatedfilesharing/lib/Settings/Personal.php4
-rw-r--r--apps/federatedfilesharing/lib/Settings/PersonalSection.php1
9 files changed, 32 insertions, 26 deletions
diff --git a/apps/federatedfilesharing/lib/AddressHandler.php b/apps/federatedfilesharing/lib/AddressHandler.php
index d21516c698c..4588e6da288 100644
--- a/apps/federatedfilesharing/lib/AddressHandler.php
+++ b/apps/federatedfilesharing/lib/AddressHandler.php
@@ -117,8 +117,8 @@ class AddressHandler {
* @return bool
*/
public function urlContainProtocol($url) {
- if (str_starts_with($url, 'https://') ||
- str_starts_with($url, 'http://')) {
+ if (str_starts_with($url, 'https://')
+ || str_starts_with($url, 'http://')) {
return true;
}
diff --git a/apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php b/apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php
index ab6db8c9c75..b8d2090713b 100644
--- a/apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php
+++ b/apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@@ -90,8 +91,8 @@ class MountPublicLinkController extends Controller {
// make sure that user is authenticated in case of a password protected link
$storedPassword = $share->getPassword();
- $authenticated = $this->session->get(PublicAuth::DAV_AUTHENTICATED) === $share->getId() ||
- $this->shareManager->checkPassword($share, $password);
+ $authenticated = $this->session->get(PublicAuth::DAV_AUTHENTICATED) === $share->getId()
+ || $this->shareManager->checkPassword($share, $password);
if (!empty($storedPassword) && !$authenticated) {
$response = new JSONResponse(
['message' => 'No permission to access the share'],
@@ -151,12 +152,11 @@ class MountPublicLinkController extends Controller {
try {
$response = $httpClient->post($remote . '/index.php/apps/federatedfilesharing/createFederatedShare',
[
- 'body' =>
- [
- 'token' => $token,
- 'shareWith' => rtrim($cloudId->getId(), '/'),
- 'password' => $password
- ],
+ 'body' => [
+ 'token' => $token,
+ 'shareWith' => rtrim($cloudId->getId(), '/'),
+ 'password' => $password
+ ],
'connect_timeout' => 10,
]
);
diff --git a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php
index 90e7f53da80..7fdd718cbfe 100644
--- a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php
+++ b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php
@@ -145,9 +145,9 @@ class RequestHandlerController extends OCSController {
#[NoCSRFRequired]
#[PublicPage]
public function reShare(int $id, ?string $token = null, ?string $shareWith = null, ?int $remoteId = 0) {
- if ($token === null ||
- $shareWith === null ||
- $remoteId === null
+ if ($token === null
+ || $shareWith === null
+ || $remoteId === null
) {
throw new OCSBadRequestException();
}
@@ -370,8 +370,8 @@ class RequestHandlerController extends OCSController {
$ocmPermissions[] = 'read';
}
- if (($ncPermissions & Constants::PERMISSION_CREATE) ||
- ($ncPermissions & Constants::PERMISSION_UPDATE)) {
+ if (($ncPermissions & Constants::PERMISSION_CREATE)
+ || ($ncPermissions & Constants::PERMISSION_UPDATE)) {
$ocmPermissions[] = 'write';
}
diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php
index 7c95b83a5dd..e3731ac3ecf 100644
--- a/apps/federatedfilesharing/lib/FederatedShareProvider.php
+++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php
@@ -88,8 +88,8 @@ class FederatedShareProvider implements IShareProvider, IShareProviderSupportsAl
$shareType = $share->getShareType();
$expirationDate = $share->getExpirationDate();
- if ($shareType === IShare::TYPE_REMOTE_GROUP &&
- !$this->isOutgoingServer2serverGroupShareEnabled()
+ if ($shareType === IShare::TYPE_REMOTE_GROUP
+ && !$this->isOutgoingServer2serverGroupShareEnabled()
) {
$message = 'It is not allowed to send federated group shares from this server.';
$message_t = $this->l->t('It is not allowed to send federated group shares from this server.');
diff --git a/apps/federatedfilesharing/lib/Notifications.php b/apps/federatedfilesharing/lib/Notifications.php
index 3ba88dad016..613c05613ef 100644
--- a/apps/federatedfilesharing/lib/Notifications.php
+++ b/apps/federatedfilesharing/lib/Notifications.php
@@ -242,10 +242,10 @@ class Notifications {
$result = $this->tryHttpPostToShareEndpoint(rtrim($remote, '/'), '/' . $remoteId . '/' . $action, $fields, $action);
$status = json_decode($result['result'], true);
- if ($result['success'] &&
- isset($status['ocs']['meta']['statuscode']) &&
- ($status['ocs']['meta']['statuscode'] === 100 ||
- $status['ocs']['meta']['statuscode'] === 200
+ if ($result['success']
+ && isset($status['ocs']['meta']['statuscode'])
+ && ($status['ocs']['meta']['statuscode'] === 100
+ || $status['ocs']['meta']['statuscode'] === 200
)
) {
return true;
diff --git a/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php b/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php
index 836b6610199..1ce639532e8 100644
--- a/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php
+++ b/apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@@ -308,7 +309,10 @@ class CloudFederationProviderFiles implements ISignedCloudFederationProvider {
$this->verifyShare($share, $token);
$this->executeAcceptShare($share);
- if ($share->getShareOwner() !== $share->getSharedBy()) {
+
+ if ($share->getShareOwner() !== $share->getSharedBy()
+ && !$this->userManager->userExists($share->getSharedBy())) {
+ // only if share was initiated from another instance
[, $remote] = $this->addressHandler->splitUserRemote($share->getSharedBy());
$remoteId = $this->federatedShareProvider->getRemoteId($share);
$notification = $this->cloudFederationFactory->getCloudFederationNotification();
@@ -702,8 +706,8 @@ class CloudFederationProviderFiles implements ISignedCloudFederationProvider {
*/
protected function verifyShare(IShare $share, $token) {
if (
- $share->getShareType() === IShare::TYPE_REMOTE &&
- $share->getToken() === $token
+ $share->getShareType() === IShare::TYPE_REMOTE
+ && $share->getToken() === $token
) {
return true;
}
diff --git a/apps/federatedfilesharing/lib/Settings/Admin.php b/apps/federatedfilesharing/lib/Settings/Admin.php
index e21c34638ad..fc685f952c7 100644
--- a/apps/federatedfilesharing/lib/Settings/Admin.php
+++ b/apps/federatedfilesharing/lib/Settings/Admin.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
diff --git a/apps/federatedfilesharing/lib/Settings/Personal.php b/apps/federatedfilesharing/lib/Settings/Personal.php
index b71b064859e..2889fb77c1f 100644
--- a/apps/federatedfilesharing/lib/Settings/Personal.php
+++ b/apps/federatedfilesharing/lib/Settings/Personal.php
@@ -49,8 +49,8 @@ class Personal implements ISettings {
* @since 9.1
*/
public function getSection(): ?string {
- if ($this->federatedShareProvider->isIncomingServer2serverShareEnabled() ||
- $this->federatedShareProvider->isIncomingServer2serverGroupShareEnabled()) {
+ if ($this->federatedShareProvider->isIncomingServer2serverShareEnabled()
+ || $this->federatedShareProvider->isIncomingServer2serverGroupShareEnabled()) {
return 'sharing';
}
return null;
diff --git a/apps/federatedfilesharing/lib/Settings/PersonalSection.php b/apps/federatedfilesharing/lib/Settings/PersonalSection.php
index 5ef1e180c31..eea10e39393 100644
--- a/apps/federatedfilesharing/lib/Settings/PersonalSection.php
+++ b/apps/federatedfilesharing/lib/Settings/PersonalSection.php
@@ -1,4 +1,5 @@
<?php
+
/**
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later