From cc944005406ac4039c38eb117af9f005dd97a8c5 Mon Sep 17 00:00:00 2001 From: "Antoon P." Date: Thu, 7 May 2026 18:35:46 +0200 Subject: [PATCH] fix(ocm): Move out of server invite-accepted capability and implementation. Use repair step instead of migration to conditionally drop table. Signed-off-by: Antoon P. --- 3rdparty | 2 +- apps/cloud_federation_api/appinfo/info.xml | 5 + apps/cloud_federation_api/appinfo/routes.php | 6 - .../composer/composer/autoload_classmap.php | 5 +- .../composer/composer/autoload_static.php | 9 +- .../lib/AppInfo/Application.php | 2 - .../cloud_federation_api/lib/Capabilities.php | 34 ---- .../Controller/RequestHandlerController.php | 101 ---------- .../lib/Db/FederatedInvite.php | 62 ------- .../lib/Db/FederatedInviteMapper.php | 33 ---- .../Events/FederatedInviteAcceptedEvent.php | 24 --- .../Migration/DropFederatedInvitesTable.php | 54 ++++++ apps/cloud_federation_api/openapi.json | 170 ----------------- .../tests/RequestHandlerControllerTest.php | 137 -------------- lib/private/OCM/OCMDiscoveryService.php | 8 +- .../OCM/Events/LocalOCMDiscoveryEvent.php | 11 ++ openapi.json | 173 ------------------ 17 files changed, 76 insertions(+), 760 deletions(-) delete mode 100644 apps/cloud_federation_api/lib/Capabilities.php delete mode 100644 apps/cloud_federation_api/lib/Db/FederatedInvite.php delete mode 100644 apps/cloud_federation_api/lib/Db/FederatedInviteMapper.php delete mode 100644 apps/cloud_federation_api/lib/Events/FederatedInviteAcceptedEvent.php create mode 100644 apps/cloud_federation_api/lib/Migration/DropFederatedInvitesTable.php delete mode 100644 apps/cloud_federation_api/tests/RequestHandlerControllerTest.php diff --git a/3rdparty b/3rdparty index 5d09a7f56e2d0..8f97d8cef37b3 160000 --- a/3rdparty +++ b/3rdparty @@ -1 +1 @@ -Subproject commit 5d09a7f56e2d01b5f4083e65db77c4f7aa775252 +Subproject commit 8f97d8cef37b32d25e36c16fc2f7be36f1a46901 diff --git a/apps/cloud_federation_api/appinfo/info.xml b/apps/cloud_federation_api/appinfo/info.xml index 84fc243a63fff..e23b1d1a28fda 100644 --- a/apps/cloud_federation_api/appinfo/info.xml +++ b/apps/cloud_federation_api/appinfo/info.xml @@ -21,4 +21,9 @@ + + + OCA\CloudFederationAPI\Migration\DropFederatedInvitesTable + + diff --git a/apps/cloud_federation_api/appinfo/routes.php b/apps/cloud_federation_api/appinfo/routes.php index cd681ae98e7f2..9dcffd0aa3489 100644 --- a/apps/cloud_federation_api/appinfo/routes.php +++ b/apps/cloud_federation_api/appinfo/routes.php @@ -20,12 +20,6 @@ 'verb' => 'POST', 'root' => '/ocm', ], - [ - 'name' => 'RequestHandler#inviteAccepted', - 'url' => '/invite-accepted', - 'verb' => 'POST', - 'root' => '/ocm', - ], // needs to be kept at the bottom of the list [ diff --git a/apps/cloud_federation_api/composer/composer/autoload_classmap.php b/apps/cloud_federation_api/composer/composer/autoload_classmap.php index 5441bfc832535..69626a554012e 100644 --- a/apps/cloud_federation_api/composer/composer/autoload_classmap.php +++ b/apps/cloud_federation_api/composer/composer/autoload_classmap.php @@ -8,13 +8,10 @@ return array( 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', 'OCA\\CloudFederationAPI\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php', - 'OCA\\CloudFederationAPI\\Capabilities' => $baseDir . '/../lib/Capabilities.php', 'OCA\\CloudFederationAPI\\Config' => $baseDir . '/../lib/Config.php', 'OCA\\CloudFederationAPI\\Controller\\OCMRequestController' => $baseDir . '/../lib/Controller/OCMRequestController.php', 'OCA\\CloudFederationAPI\\Controller\\RequestHandlerController' => $baseDir . '/../lib/Controller/RequestHandlerController.php', - 'OCA\\CloudFederationAPI\\Db\\FederatedInvite' => $baseDir . '/../lib/Db/FederatedInvite.php', - 'OCA\\CloudFederationAPI\\Db\\FederatedInviteMapper' => $baseDir . '/../lib/Db/FederatedInviteMapper.php', - 'OCA\\CloudFederationAPI\\Events\\FederatedInviteAcceptedEvent' => $baseDir . '/../lib/Events/FederatedInviteAcceptedEvent.php', 'OCA\\CloudFederationAPI\\Migration\\Version1016Date202502262004' => $baseDir . '/../lib/Migration/Version1016Date202502262004.php', + 'OCA\\CloudFederationAPI\\Migration\\DropFederatedInvitesTable' => $baseDir . '/../lib/Migration/DropFederatedInvitesTable.php', 'OCA\\CloudFederationAPI\\ResponseDefinitions' => $baseDir . '/../lib/ResponseDefinitions.php', ); diff --git a/apps/cloud_federation_api/composer/composer/autoload_static.php b/apps/cloud_federation_api/composer/composer/autoload_static.php index 6d192f98e5138..3f17678c3910e 100644 --- a/apps/cloud_federation_api/composer/composer/autoload_static.php +++ b/apps/cloud_federation_api/composer/composer/autoload_static.php @@ -7,14 +7,14 @@ class ComposerStaticInitCloudFederationAPI { public static $prefixLengthsPsr4 = array ( - 'O' => + 'O' => array ( 'OCA\\CloudFederationAPI\\' => 23, ), ); public static $prefixDirsPsr4 = array ( - 'OCA\\CloudFederationAPI\\' => + 'OCA\\CloudFederationAPI\\' => array ( 0 => __DIR__ . '/..' . '/../lib', ), @@ -23,14 +23,11 @@ class ComposerStaticInitCloudFederationAPI public static $classMap = array ( 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', 'OCA\\CloudFederationAPI\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php', - 'OCA\\CloudFederationAPI\\Capabilities' => __DIR__ . '/..' . '/../lib/Capabilities.php', 'OCA\\CloudFederationAPI\\Config' => __DIR__ . '/..' . '/../lib/Config.php', 'OCA\\CloudFederationAPI\\Controller\\OCMRequestController' => __DIR__ . '/..' . '/../lib/Controller/OCMRequestController.php', 'OCA\\CloudFederationAPI\\Controller\\RequestHandlerController' => __DIR__ . '/..' . '/../lib/Controller/RequestHandlerController.php', - 'OCA\\CloudFederationAPI\\Db\\FederatedInvite' => __DIR__ . '/..' . '/../lib/Db/FederatedInvite.php', - 'OCA\\CloudFederationAPI\\Db\\FederatedInviteMapper' => __DIR__ . '/..' . '/../lib/Db/FederatedInviteMapper.php', - 'OCA\\CloudFederationAPI\\Events\\FederatedInviteAcceptedEvent' => __DIR__ . '/..' . '/../lib/Events/FederatedInviteAcceptedEvent.php', 'OCA\\CloudFederationAPI\\Migration\\Version1016Date202502262004' => __DIR__ . '/..' . '/../lib/Migration/Version1016Date202502262004.php', + 'OCA\\CloudFederationAPI\\Migration\\DropFederatedInvitesTable' => __DIR__ . '/..' . '/../lib/Migration/DropFederatedInvitesTable.php', 'OCA\\CloudFederationAPI\\ResponseDefinitions' => __DIR__ . '/..' . '/../lib/ResponseDefinitions.php', ); diff --git a/apps/cloud_federation_api/lib/AppInfo/Application.php b/apps/cloud_federation_api/lib/AppInfo/Application.php index 39238b3dae7d8..5e07fda62009a 100644 --- a/apps/cloud_federation_api/lib/AppInfo/Application.php +++ b/apps/cloud_federation_api/lib/AppInfo/Application.php @@ -8,7 +8,6 @@ */ namespace OCA\CloudFederationAPI\AppInfo; -use OCA\CloudFederationAPI\Capabilities; use OCP\AppFramework\App; use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Bootstrap\IBootstrap; @@ -23,7 +22,6 @@ public function __construct() { #[\Override] public function register(IRegistrationContext $context): void { - $context->registerCapability(Capabilities::class); } #[\Override] diff --git a/apps/cloud_federation_api/lib/Capabilities.php b/apps/cloud_federation_api/lib/Capabilities.php deleted file mode 100644 index 99b7ca528cc7d..0000000000000 --- a/apps/cloud_federation_api/lib/Capabilities.php +++ /dev/null @@ -1,34 +0,0 @@ -> - * @throws OCMArgumentException - */ - #[\Override] - public function getCapabilities() { - $provider = $this->ocmDiscoveryService->getLocalOCMProvider(false); - return ['ocm' => $provider->jsonSerialize()]; - } -} diff --git a/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php b/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php index 06480df1ad5a4..5548181128acb 100644 --- a/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php +++ b/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php @@ -9,12 +9,9 @@ use OC\OCM\OCMSignatoryManager; use OCA\CloudFederationAPI\Config; -use OCA\CloudFederationAPI\Db\FederatedInviteMapper; -use OCA\CloudFederationAPI\Events\FederatedInviteAcceptedEvent; use OCA\CloudFederationAPI\ResponseDefinitions; use OCA\FederatedFileSharing\AddressHandler; use OCP\AppFramework\Controller; -use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\BruteForceProtection; use OCP\AppFramework\Http\Attribute\NoCSRFRequired; @@ -22,7 +19,6 @@ use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\EventDispatcher\IEventDispatcher; use OCP\Federation\Exceptions\ActionNotSupportedException; use OCP\Federation\Exceptions\AuthenticationFailedException; use OCP\Federation\Exceptions\BadRequestException; @@ -67,8 +63,6 @@ public function __construct( private IURLGenerator $urlGenerator, private ICloudFederationProviderManager $cloudFederationProviderManager, private Config $config, - private IEventDispatcher $dispatcher, - private FederatedInviteMapper $federatedInviteMapper, private readonly AddressHandler $addressHandler, private readonly IAppConfig $appConfig, private ICloudFederationFactory $factory, @@ -225,101 +219,6 @@ public function addShare($shareWith, $name, $description, $providerId, $owner, $ return new JSONResponse($responseData, Http::STATUS_CREATED); } - /** - * Inform the sender that an invitation was accepted to start sharing - * - * Inform about an accepted invitation so the user on the sender provider's side - * can initiate the OCM share creation. To protect the identity of the parties, - * for shares created following an OCM invitation, the user id MAY be hashed, - * and recipients implementing the OCM invitation workflow MAY refuse to process - * shares coming from unknown parties. - * @link https://cs3org.github.io/OCM-API/docs.html?branch=v1.1.0&repo=OCM-API&user=cs3org#/paths/~1invite-accepted/post - * - * @param string $recipientProvider The address of the recipent's provider - * @param string $token The token used for the invitation - * @param string $userID The userID of the recipient at the recipient's provider - * @param string $email The email address of the recipient - * @param string $name The display name of the recipient - * - * @return JSONResponse|JSONResponse - * - * Note: Not implementing 404 Invitation token does not exist, instead using 400 - * 200: Invitation accepted - * 400: Invalid token - * 403: Invitation token does not exist - * 409: User is already known by the OCM provider - */ - #[PublicPage] - #[NoCSRFRequired] - #[BruteForceProtection(action: 'inviteAccepted')] - public function inviteAccepted(string $recipientProvider, string $token, string $userID, string $email, string $name): JSONResponse { - $this->logger->debug('Processing share invitation for ' . $userID . ' with token ' . $token . ' and email ' . $email . ' and name ' . $name); - - $updated = $this->timeFactory->getTime(); - - if ($token === '') { - $response = new JSONResponse(['message' => 'Invalid or non existing token', 'error' => true], Http::STATUS_BAD_REQUEST); - $response->throttle(); - return $response; - } - - try { - $invitation = $this->federatedInviteMapper->findByToken($token); - } catch (DoesNotExistException) { - $response = ['message' => 'Invalid or non existing token', 'error' => true]; - $status = Http::STATUS_BAD_REQUEST; - $response = new JSONResponse($response, $status); - $response->throttle(); - return $response; - } - - if ($invitation->isAccepted() === true) { - $response = ['message' => 'Invite already accepted', 'error' => true]; - $status = Http::STATUS_CONFLICT; - return new JSONResponse($response, $status); - } - - if ($invitation->getExpiredAt() !== null && $updated > $invitation->getExpiredAt()) { - $response = ['message' => 'Invitation expired', 'error' => true]; - $status = Http::STATUS_BAD_REQUEST; - return new JSONResponse($response, $status); - } - $localUser = $this->userManager->get($invitation->getUserId()); - if ($localUser === null) { - $response = ['message' => 'Invalid or non existing token', 'error' => true]; - $status = Http::STATUS_BAD_REQUEST; - $response = new JSONResponse($response, $status); - $response->throttle(); - return $response; - } - - $sharedFromEmail = $localUser->getEMailAddress(); - if ($sharedFromEmail === null) { - $response = ['message' => 'Invalid or non existing token', 'error' => true]; - $status = Http::STATUS_BAD_REQUEST; - $response = new JSONResponse($response, $status); - $response->throttle(); - return $response; - } - $sharedFromDisplayName = $localUser->getDisplayName(); - - $response = ['userID' => $localUser->getUID(), 'email' => $sharedFromEmail, 'name' => $sharedFromDisplayName]; - $status = Http::STATUS_OK; - - $invitation->setAccepted(true); - $invitation->setRecipientEmail($email); - $invitation->setRecipientName($name); - $invitation->setRecipientProvider($recipientProvider); - $invitation->setRecipientUserId($userID); - $invitation->setAcceptedAt($updated); - $invitation = $this->federatedInviteMapper->update($invitation); - - $event = new FederatedInviteAcceptedEvent($invitation); - $this->dispatcher->dispatchTyped($event); - - return new JSONResponse($response, $status); - } - /** * Send a notification about an existing share * diff --git a/apps/cloud_federation_api/lib/Db/FederatedInvite.php b/apps/cloud_federation_api/lib/Db/FederatedInvite.php deleted file mode 100644 index b2447ff4e23ce..0000000000000 --- a/apps/cloud_federation_api/lib/Db/FederatedInvite.php +++ /dev/null @@ -1,62 +0,0 @@ -addType('accepted', Types::BOOLEAN); - $this->addType('acceptedAt', Types::BIGINT); - $this->addType('createdAt', Types::BIGINT); - $this->addType('expiredAt', Types::BIGINT); - $this->addType('recipientEmail', Types::STRING); - $this->addType('recipientName', Types::STRING); - $this->addType('recipientProvider', Types::STRING); - $this->addType('recipientUserId', Types::STRING); - $this->addType('token', Types::STRING); - $this->addType('userId', Types::STRING); - } -} diff --git a/apps/cloud_federation_api/lib/Db/FederatedInviteMapper.php b/apps/cloud_federation_api/lib/Db/FederatedInviteMapper.php deleted file mode 100644 index 5feb08b2c7f52..0000000000000 --- a/apps/cloud_federation_api/lib/Db/FederatedInviteMapper.php +++ /dev/null @@ -1,33 +0,0 @@ - - */ -class FederatedInviteMapper extends QBMapper { - public const TABLE_NAME = 'federated_invites'; - - public function __construct(IDBConnection $db) { - parent::__construct($db, self::TABLE_NAME); - } - - public function findByToken(string $token): FederatedInvite { - $qb = $this->db->getQueryBuilder(); - $qb->select('*') - ->from('federated_invites') - ->where($qb->expr()->eq('token', $qb->createNamedParameter($token))); - return $this->findEntity($qb); - } - -} diff --git a/apps/cloud_federation_api/lib/Events/FederatedInviteAcceptedEvent.php b/apps/cloud_federation_api/lib/Events/FederatedInviteAcceptedEvent.php deleted file mode 100644 index c4d079d083ea9..0000000000000 --- a/apps/cloud_federation_api/lib/Events/FederatedInviteAcceptedEvent.php +++ /dev/null @@ -1,24 +0,0 @@ -invitation; - } -} diff --git a/apps/cloud_federation_api/lib/Migration/DropFederatedInvitesTable.php b/apps/cloud_federation_api/lib/Migration/DropFederatedInvitesTable.php new file mode 100644 index 0000000000000..988876ef21f88 --- /dev/null +++ b/apps/cloud_federation_api/lib/Migration/DropFederatedInvitesTable.php @@ -0,0 +1,54 @@ +db); + if (!$schema->hasTable($table_name)) { + echo("$table_name does not exist"); + return; + } + $qb = $this->db->getQueryBuilder(); + $qb->select('*') + ->from($table_name) + ->setMaxResults(1); + $result = $qb->executeQuery(); + $hasRows = $result->fetchOne(); + if (!$hasRows) { + $schema->dropTable($table_name); + $schema->performDropTableCalls(); + $output->info('Table federated_invites dropped'); + } else { + $output->info('Table federated_invites contains data. Table will be kept.'); + } + } +} diff --git a/apps/cloud_federation_api/openapi.json b/apps/cloud_federation_api/openapi.json index 21f669a2c5f79..92b0a187ff5ea 100644 --- a/apps/cloud_federation_api/openapi.json +++ b/apps/cloud_federation_api/openapi.json @@ -34,15 +34,6 @@ } } }, - "Capabilities": { - "type": "object", - "additionalProperties": { - "type": "object", - "additionalProperties": { - "type": "object" - } - } - }, "Error": { "type": "object", "required": [ @@ -327,167 +318,6 @@ } } } - }, - "/index.php/ocm/invite-accepted": { - "post": { - "operationId": "request_handler-invite-accepted", - "summary": "Inform the sender that an invitation was accepted to start sharing", - "description": "Inform about an accepted invitation so the user on the sender provider's side can initiate the OCM share creation. To protect the identity of the parties, for shares created following an OCM invitation, the user id MAY be hashed, and recipients implementing the OCM invitation workflow MAY refuse to process shares coming from unknown parties.\nhttps://cs3org.github.io/OCM-API/docs.html?branch=v1.1.0&repo=OCM-API&user=cs3org#/paths/~1invite-accepted/post\nNote: Not implementing 404 Invitation token does not exist, instead using 400", - "tags": [ - "request_handler" - ], - "security": [ - {}, - { - "bearer_auth": [] - }, - { - "basic_auth": [] - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "recipientProvider", - "token", - "userID", - "email", - "name" - ], - "properties": { - "recipientProvider": { - "type": "string", - "description": "The address of the recipent's provider" - }, - "token": { - "type": "string", - "description": "The token used for the invitation" - }, - "userID": { - "type": "string", - "description": "The userID of the recipient at the recipient's provider" - }, - "email": { - "type": "string", - "description": "The email address of the recipient" - }, - "name": { - "type": "string", - "description": "The display name of the recipient" - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Invitation accepted", - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "userID", - "email", - "name" - ], - "properties": { - "userID": { - "type": "string" - }, - "email": { - "type": "string" - }, - "name": { - "type": "string" - } - } - } - } - } - }, - "403": { - "description": "Invitation token does not exist", - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "message", - "error" - ], - "properties": { - "message": { - "type": "string" - }, - "error": { - "type": "boolean", - "enum": [ - true - ] - } - } - } - } - } - }, - "400": { - "description": "Invalid token", - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "message", - "error" - ], - "properties": { - "message": { - "type": "string" - }, - "error": { - "type": "boolean", - "enum": [ - true - ] - } - } - } - } - } - }, - "409": { - "description": "User is already known by the OCM provider", - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "message", - "error" - ], - "properties": { - "message": { - "type": "string" - }, - "error": { - "type": "boolean", - "enum": [ - true - ] - } - } - } - } - } - } - } - } } }, "tags": [ diff --git a/apps/cloud_federation_api/tests/RequestHandlerControllerTest.php b/apps/cloud_federation_api/tests/RequestHandlerControllerTest.php deleted file mode 100644 index 04cabbd234c25..0000000000000 --- a/apps/cloud_federation_api/tests/RequestHandlerControllerTest.php +++ /dev/null @@ -1,137 +0,0 @@ -request = $this->createMock(IRequest::class); - $this->logger = $this->createMock(LoggerInterface::class); - $this->userManager = $this->createMock(IUserManager::class); - $this->groupManager = $this->createMock(IGroupManager::class); - $this->urlGenerator = $this->createMock(IURLGenerator::class); - $this->cloudFederationProviderManager = $this->createMock(ICloudFederationProviderManager::class); - $this->config = $this->createMock(Config::class); - $this->eventDispatcher = $this->createMock(IEventDispatcher::class); - $this->federatedInviteMapper = $this->createMock(FederatedInviteMapper::class); - $this->addressHandler = $this->createMock(AddressHandler::class); - $this->appConfig = $this->createMock(IAppConfig::class); - $this->cloudFederationFactory = $this->createMock(ICloudFederationFactory::class); - $this->cloudIdManager = $this->createMock(ICloudIdManager::class); - $this->discoveryService = $this->createMock(IOCMDiscoveryService::class); - $this->signatureManager = $this->createMock(ISignatureManager::class); - $this->timeFactory = $this->createMock(ITimeFactory::class); - - $this->requestHandlerController = new RequestHandlerController( - 'cloud_federation_api', - $this->request, - $this->logger, - $this->userManager, - $this->groupManager, - $this->urlGenerator, - $this->cloudFederationProviderManager, - $this->config, - $this->eventDispatcher, - $this->federatedInviteMapper, - $this->addressHandler, - $this->appConfig, - $this->cloudFederationFactory, - $this->cloudIdManager, - $this->discoveryService, - $this->signatureManager, - $this->timeFactory, - ); - } - - public function testInviteAccepted(): void { - $token = 'token'; - $userId = 'userId'; - $invite = new FederatedInvite(); - $invite->setCreatedAt(1); - $invite->setUserId($userId); - $invite->setToken($token); - - $this->federatedInviteMapper->expects(self::once()) - ->method('findByToken') - ->with($token) - ->willReturn($invite); - - $this->federatedInviteMapper->expects(self::once()) - ->method('update') - ->willReturnArgument(0); - - $user = $this->createMock(IUser::class); - $user->method('getUID') - ->willReturn($userId); - $user->method('getEMailAddress') - ->willReturn('email'); - $user->method('getDisplayName') - ->willReturn('displayName'); - - $this->userManager->expects(self::once()) - ->method('get') - ->with($userId) - ->willReturn($user); - - $recipientProvider = 'http://127.0.0.1'; - $recipientId = 'remote'; - $recipientEmail = 'remote@example.org'; - $recipientName = 'Remote Remoteson'; - $response = ['userID' => $userId, 'email' => 'email', 'name' => 'displayName']; - $json = new JSONResponse($response, Http::STATUS_OK); - - $this->assertEquals($json, $this->requestHandlerController->inviteAccepted($recipientProvider, $token, $recipientId, $recipientEmail, $recipientName)); - } -} diff --git a/lib/private/OCM/OCMDiscoveryService.php b/lib/private/OCM/OCMDiscoveryService.php index 9459e9a03f043..3956ea10fec64 100644 --- a/lib/private/OCM/OCMDiscoveryService.php +++ b/lib/private/OCM/OCMDiscoveryService.php @@ -202,13 +202,7 @@ public function getLocalOCMProvider(bool $fullDetails = true): IOCMProvider { $provider->setEnabled(true); $provider->setApiVersion(self::API_VERSION); $provider->setEndPoint(substr($url, 0, $pos)); - $provider->setCapabilities(['invite-accepted', 'notifications', 'shares']); - - // The inviteAcceptDialog is available from the contacts app, if this config value is set - $inviteAcceptDialog = $this->appConfig->getValueString('core', ConfigLexicon::OCM_INVITE_ACCEPT_DIALOG); - if ($inviteAcceptDialog !== '') { - $provider->setInviteAcceptDialog($this->urlGenerator->linkToRouteAbsolute($inviteAcceptDialog)); - } + $provider->setCapabilities(['notifications', 'shares']); $resource = $provider->createNewResourceType(); $resource->setName('file') diff --git a/lib/public/OCM/Events/LocalOCMDiscoveryEvent.php b/lib/public/OCM/Events/LocalOCMDiscoveryEvent.php index a6ef943145b17..6c44b2c2b5e8e 100644 --- a/lib/public/OCM/Events/LocalOCMDiscoveryEvent.php +++ b/lib/public/OCM/Events/LocalOCMDiscoveryEvent.php @@ -54,4 +54,15 @@ public function registerResourceType(string $name, array $shareTypes, array $pro ->setProtocols($protocols); $this->provider->addResourceType($resourceType); } + + /** + * Returns the ocm provider. + * + * @return IOCMProvider + * + * @since 34.0.0 + */ + public function getProvider(): IOCMProvider { + return $this->provider; + } } diff --git a/openapi.json b/openapi.json index d8a2cc3985753..09f839c33dc2b 100644 --- a/openapi.json +++ b/openapi.json @@ -1296,15 +1296,6 @@ } } }, - "CloudFederationApiCapabilities": { - "type": "object", - "additionalProperties": { - "type": "object", - "additionalProperties": { - "type": "object" - } - } - }, "CloudFederationApiError": { "type": "object", "required": [ @@ -7307,9 +7298,6 @@ { "$ref": "#/components/schemas/CorePublicCapabilities" }, - { - "$ref": "#/components/schemas/CloudFederationApiCapabilities" - }, { "$ref": "#/components/schemas/CommentsCapabilities" }, @@ -18302,167 +18290,6 @@ } } }, - "/index.php/ocm/invite-accepted": { - "post": { - "operationId": "cloud_federation_api-request_handler-invite-accepted", - "summary": "Inform the sender that an invitation was accepted to start sharing", - "description": "Inform about an accepted invitation so the user on the sender provider's side can initiate the OCM share creation. To protect the identity of the parties, for shares created following an OCM invitation, the user id MAY be hashed, and recipients implementing the OCM invitation workflow MAY refuse to process shares coming from unknown parties.\nhttps://cs3org.github.io/OCM-API/docs.html?branch=v1.1.0&repo=OCM-API&user=cs3org#/paths/~1invite-accepted/post\nNote: Not implementing 404 Invitation token does not exist, instead using 400", - "tags": [ - "cloud_federation_api/request_handler" - ], - "security": [ - {}, - { - "bearer_auth": [] - }, - { - "basic_auth": [] - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "recipientProvider", - "token", - "userID", - "email", - "name" - ], - "properties": { - "recipientProvider": { - "type": "string", - "description": "The address of the recipent's provider" - }, - "token": { - "type": "string", - "description": "The token used for the invitation" - }, - "userID": { - "type": "string", - "description": "The userID of the recipient at the recipient's provider" - }, - "email": { - "type": "string", - "description": "The email address of the recipient" - }, - "name": { - "type": "string", - "description": "The display name of the recipient" - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Invitation accepted", - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "userID", - "email", - "name" - ], - "properties": { - "userID": { - "type": "string" - }, - "email": { - "type": "string" - }, - "name": { - "type": "string" - } - } - } - } - } - }, - "403": { - "description": "Invitation token does not exist", - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "message", - "error" - ], - "properties": { - "message": { - "type": "string" - }, - "error": { - "type": "boolean", - "enum": [ - true - ] - } - } - } - } - } - }, - "400": { - "description": "Invalid token", - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "message", - "error" - ], - "properties": { - "message": { - "type": "string" - }, - "error": { - "type": "boolean", - "enum": [ - true - ] - } - } - } - } - } - }, - "409": { - "description": "User is already known by the OCM provider", - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "message", - "error" - ], - "properties": { - "message": { - "type": "string" - }, - "error": { - "type": "boolean", - "enum": [ - true - ] - } - } - } - } - } - } - } - } - }, "/ocs/v2.php/apps/dashboard/api/v1/widget-items": { "get": { "operationId": "dashboard-dashboard_api-get-widget-items",