aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/Middleware
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/lib/Middleware')
-rw-r--r--apps/files_sharing/lib/Middleware/OCSShareAPIMiddleware.php37
-rw-r--r--apps/files_sharing/lib/Middleware/ShareInfoMiddleware.php31
-rw-r--r--apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php71
3 files changed, 29 insertions, 110 deletions
diff --git a/apps/files_sharing/lib/Middleware/OCSShareAPIMiddleware.php b/apps/files_sharing/lib/Middleware/OCSShareAPIMiddleware.php
index aba6124f415..6671a78efff 100644
--- a/apps/files_sharing/lib/Middleware/OCSShareAPIMiddleware.php
+++ b/apps/files_sharing/lib/Middleware/OCSShareAPIMiddleware.php
@@ -1,26 +1,8 @@
<?php
+
/**
- * @copyright Copyright (c) 2016 Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @author Lukas Reschke <lukas@statuscode.ch>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Files_Sharing\Middleware;
@@ -33,15 +15,10 @@ use OCP\IL10N;
use OCP\Share\IManager;
class OCSShareAPIMiddleware extends Middleware {
- /** @var IManager */
- private $shareManager;
- /** @var IL10N */
- private $l;
-
- public function __construct(IManager $shareManager,
- IL10N $l) {
- $this->shareManager = $shareManager;
- $this->l = $l;
+ public function __construct(
+ private IManager $shareManager,
+ private IL10N $l,
+ ) {
}
/**
diff --git a/apps/files_sharing/lib/Middleware/ShareInfoMiddleware.php b/apps/files_sharing/lib/Middleware/ShareInfoMiddleware.php
index adc6116af45..e96940979bf 100644
--- a/apps/files_sharing/lib/Middleware/ShareInfoMiddleware.php
+++ b/apps/files_sharing/lib/Middleware/ShareInfoMiddleware.php
@@ -1,25 +1,8 @@
<?php
+
/**
- * @copyright Copyright (c) 2016 Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Files_Sharing\Middleware;
@@ -33,11 +16,9 @@ use OCP\AppFramework\Middleware;
use OCP\Share\IManager;
class ShareInfoMiddleware extends Middleware {
- /** @var IManager */
- private $shareManager;
-
- public function __construct(IManager $shareManager) {
- $this->shareManager = $shareManager;
+ public function __construct(
+ private IManager $shareManager,
+ ) {
}
/**
diff --git a/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php b/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php
index 005fc75c849..8ea2eb59d73 100644
--- a/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php
+++ b/apps/files_sharing/lib/Middleware/SharingCheckMiddleware.php
@@ -1,31 +1,10 @@
<?php
declare(strict_types=1);
-
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Bjoern Schiessle <bjoern@schiessle.org>
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Lukas Reschke <lukas@statuscode.ch>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OCA\Files_Sharing\Middleware;
@@ -50,32 +29,14 @@ use OCP\Share\IManager;
*/
class SharingCheckMiddleware extends Middleware {
- /** @var string */
- protected $appName;
- /** @var IConfig */
- protected $config;
- /** @var IAppManager */
- protected $appManager;
- /** @var IControllerMethodReflector */
- protected $reflector;
- /** @var IManager */
- protected $shareManager;
- /** @var IRequest */
- protected $request;
-
- public function __construct(string $appName,
- IConfig $config,
- IAppManager $appManager,
- IControllerMethodReflector $reflector,
- IManager $shareManager,
- IRequest $request
+ public function __construct(
+ protected string $appName,
+ protected IConfig $config,
+ protected IAppManager $appManager,
+ protected IControllerMethodReflector $reflector,
+ protected IManager $shareManager,
+ protected IRequest $request,
) {
- $this->appName = $appName;
- $this->config = $config;
- $this->appManager = $appManager;
- $this->reflector = $reflector;
- $this->shareManager = $shareManager;
- $this->request = $request;
}
/**
@@ -91,8 +52,8 @@ class SharingCheckMiddleware extends Middleware {
throw new NotFoundException('Sharing is disabled.');
}
- if ($controller instanceof ExternalSharesController &&
- !$this->externalSharesChecks()) {
+ if ($controller instanceof ExternalSharesController
+ && !$this->externalSharesChecks()) {
throw new S2SException('Federated sharing not allowed');
}
}
@@ -123,13 +84,13 @@ class SharingCheckMiddleware extends Middleware {
* @return bool
*/
private function externalSharesChecks(): bool {
- if (!$this->reflector->hasAnnotation('NoIncomingFederatedSharingRequired') &&
- $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') !== 'yes') {
+ if (!$this->reflector->hasAnnotation('NoIncomingFederatedSharingRequired')
+ && $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') !== 'yes') {
return false;
}
- if (!$this->reflector->hasAnnotation('NoOutgoingFederatedSharingRequired') &&
- $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') !== 'yes') {
+ if (!$this->reflector->hasAnnotation('NoOutgoingFederatedSharingRequired')
+ && $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') !== 'yes') {
return false;
}