2014-12-04 13:51:04 -05:00
|
|
|
<?php
|
|
|
|
|
/**
|
2024-06-06 13:48:28 -04:00
|
|
|
* SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2014-12-04 13:51:04 -05:00
|
|
|
*/
|
2016-10-24 05:46:25 -04:00
|
|
|
namespace OCA\Files_Sharing\Controller;
|
2014-12-04 13:51:04 -05:00
|
|
|
|
|
|
|
|
use OCP\AppFramework\Controller;
|
2024-07-25 07:14:46 -04:00
|
|
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
2014-12-04 13:51:04 -05:00
|
|
|
use OCP\AppFramework\Http\JSONResponse;
|
2019-11-22 14:52:10 -05:00
|
|
|
use OCP\IRequest;
|
2014-12-04 13:51:04 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class ExternalSharesController
|
|
|
|
|
*
|
2016-10-24 05:46:25 -04:00
|
|
|
* @package OCA\Files_Sharing\Controller
|
2014-12-04 13:51:04 -05:00
|
|
|
*/
|
|
|
|
|
class ExternalSharesController extends Controller {
|
2023-10-11 05:52:10 -04:00
|
|
|
public function __construct(
|
|
|
|
|
string $appName,
|
|
|
|
|
IRequest $request,
|
|
|
|
|
private \OCA\Files_Sharing\External\Manager $externalManager,
|
|
|
|
|
) {
|
2014-12-04 13:51:04 -05:00
|
|
|
parent::__construct($appName, $request);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-02 03:57:33 -04:00
|
|
|
* @NoOutgoingFederatedSharingRequired
|
2014-12-04 13:51:04 -05:00
|
|
|
*
|
|
|
|
|
* @return JSONResponse
|
|
|
|
|
*/
|
2024-07-25 07:14:46 -04:00
|
|
|
#[NoAdminRequired]
|
2014-12-04 13:51:04 -05:00
|
|
|
public function index() {
|
2015-10-02 03:57:33 -04:00
|
|
|
return new JSONResponse($this->externalManager->getOpenShares());
|
2014-12-04 13:51:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-02 03:57:33 -04:00
|
|
|
* @NoOutgoingFederatedSharingRequired
|
2014-12-04 13:51:04 -05:00
|
|
|
*
|
|
|
|
|
* @param int $id
|
|
|
|
|
* @return JSONResponse
|
|
|
|
|
*/
|
2024-07-25 07:14:46 -04:00
|
|
|
#[NoAdminRequired]
|
2014-12-04 13:51:04 -05:00
|
|
|
public function create($id) {
|
2015-10-02 03:57:33 -04:00
|
|
|
$this->externalManager->acceptShare($id);
|
2014-12-04 13:51:04 -05:00
|
|
|
return new JSONResponse();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-10-02 03:57:33 -04:00
|
|
|
* @NoOutgoingFederatedSharingRequired
|
2014-12-04 13:51:04 -05:00
|
|
|
*
|
2015-12-07 07:05:27 -05:00
|
|
|
* @param integer $id
|
2014-12-04 13:51:04 -05:00
|
|
|
* @return JSONResponse
|
|
|
|
|
*/
|
2024-07-25 07:14:46 -04:00
|
|
|
#[NoAdminRequired]
|
2014-12-04 13:51:04 -05:00
|
|
|
public function destroy($id) {
|
2015-10-02 03:57:33 -04:00
|
|
|
$this->externalManager->declineShare($id);
|
2014-12-04 13:51:04 -05:00
|
|
|
return new JSONResponse();
|
|
|
|
|
}
|
|
|
|
|
}
|