You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nextcloud-server/apps/sharing/lib/Middleware/ShareApiEnabledMiddleware.php

26 lines
686 B

<?php
/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
declare(strict_types=1);
namespace OCA\Sharing\Middleware;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Middleware;
use OCP\AppFramework\OCS\OCSException;
use OCP\Server;
use OCP\Share\IManager;
final class ShareApiEnabledMiddleware extends Middleware {
#[\Override]
public function beforeController(Controller $controller, string $methodName): void {
if (!Server::get(IManager::class)->shareApiEnabled()) {
throw new OCSException('The Share API is not enabled.', Http::STATUS_NOT_IMPLEMENTED);
}
}
}