From 040d402348ca709c94e43a98bf34553fdefdcb44 Mon Sep 17 00:00:00 2001 From: "Antoon P." Date: Thu, 23 Jul 2026 14:39:43 +0200 Subject: [PATCH] fix(ocm): Move invite-accepted capability and implementation to contacts app. Backport of PR #57853 Signed-off-by: Antoon P. --- apps/cloud_federation_api/appinfo/info.xml | 6 + apps/cloud_federation_api/appinfo/routes.php | 6 - .../composer/composer/autoload_classmap.php | 5 +- .../composer/composer/autoload_static.php | 5 +- .../lib/AppInfo/Application.php | 2 - .../cloud_federation_api/lib/Capabilities.php | 33 ---- .../Controller/RequestHandlerController.php | 99 ---------- .../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 -------------- core/AppInfo/ConfigLexicon.php | 2 - lib/private/OCM/OCMDiscoveryService.php | 8 +- .../OCM/Events/LocalOCMDiscoveryEvent.php | 11 ++ openapi.json | 173 ------------------ psalm.xml | 1 - 18 files changed, 74 insertions(+), 757 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/apps/cloud_federation_api/appinfo/info.xml b/apps/cloud_federation_api/appinfo/info.xml index 43ce99a6c507c..885b23a32be3b 100644 --- a/apps/cloud_federation_api/appinfo/info.xml +++ b/apps/cloud_federation_api/appinfo/info.xml @@ -21,4 +21,10 @@ + + + + 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..c338ba5f627b2 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\\DropFederatedInvitesTable' => $baseDir . '/../lib/Migration/DropFederatedInvitesTable.php', 'OCA\\CloudFederationAPI\\Migration\\Version1016Date202502262004' => $baseDir . '/../lib/Migration/Version1016Date202502262004.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..bb848b2157052 100644 --- a/apps/cloud_federation_api/composer/composer/autoload_static.php +++ b/apps/cloud_federation_api/composer/composer/autoload_static.php @@ -23,13 +23,10 @@ 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\\DropFederatedInvitesTable' => __DIR__ . '/..' . '/../lib/Migration/DropFederatedInvitesTable.php', 'OCA\\CloudFederationAPI\\Migration\\Version1016Date202502262004' => __DIR__ . '/..' . '/../lib/Migration/Version1016Date202502262004.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 e34b2f2dc3dbb..00864699c1c03 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; @@ -22,7 +21,6 @@ public function __construct() { } public function register(IRegistrationContext $context): void { - $context->registerCapability(Capabilities::class); } public function boot(IBootContext $context): void { diff --git a/apps/cloud_federation_api/lib/Capabilities.php b/apps/cloud_federation_api/lib/Capabilities.php deleted file mode 100644 index a7417c43c2fa0..0000000000000 --- a/apps/cloud_federation_api/lib/Capabilities.php +++ /dev/null @@ -1,33 +0,0 @@ -> - * @throws OCMArgumentException - */ - 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 6c66414471fc9..4a7d12ed64bfa 100644 --- a/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php +++ b/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php @@ -10,12 +10,9 @@ use OC\AppFramework\Http\Attributes\FederationRateLimit; 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; @@ -69,7 +66,6 @@ public function __construct( private ICloudFederationProviderManager $cloudFederationProviderManager, private Config $config, private IEventDispatcher $dispatcher, - private FederatedInviteMapper $federatedInviteMapper, private readonly AddressHandler $addressHandler, private readonly IAppConfig $appConfig, private ICloudFederationFactory $factory, @@ -249,101 +245,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/core/AppInfo/ConfigLexicon.php b/core/AppInfo/ConfigLexicon.php index 508a090e8a4ff..1813961dd4e9f 100644 --- a/core/AppInfo/ConfigLexicon.php +++ b/core/AppInfo/ConfigLexicon.php @@ -28,7 +28,6 @@ class ConfigLexicon implements ILexicon { public const SHARE_LINK_EXPIRE_DATE_ENFORCED = 'shareapi_enforce_expire_date'; public const USER_LANGUAGE = 'lang'; public const OCM_DISCOVERY_ENABLED = 'ocm_discovery_enabled'; - public const OCM_INVITE_ACCEPT_DIALOG = 'ocm_invite_accept_dialog'; public const USER_LOCALE = 'locale'; public const USER_TIMEZONE = 'timezone'; @@ -92,7 +91,6 @@ public function getAppConfigs(): array { ), new Entry(self::LASTCRON_TIMESTAMP, ValueType::INT, 0, 'timestamp of last cron execution'), new Entry(self::OCM_DISCOVERY_ENABLED, ValueType::BOOL, true, 'enable/disable OCM'), - new Entry(self::OCM_INVITE_ACCEPT_DIALOG, ValueType::STRING, '', 'route to local invite accept dialog', note: 'set as empty string to disable feature'), new Entry(self::UNIFIED_SEARCH_MIN_SEARCH_LENGTH, ValueType::INT, 1, 'Minimum search length to trigger the request', rename: 'unified-search.min-search-length'), new Entry(self::UNIFIED_SEARCH_MAX_RESULTS_PER_REQUEST, ValueType::INT, 25, 'Maximum results returned per search request', rename: 'unified-search.max-results-per-request'), new Entry( diff --git a/lib/private/OCM/OCMDiscoveryService.php b/lib/private/OCM/OCMDiscoveryService.php index 17a84c12d5007..896c59d3e3dca 100644 --- a/lib/private/OCM/OCMDiscoveryService.php +++ b/lib/private/OCM/OCMDiscoveryService.php @@ -200,13 +200,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..8c4b7cb38d8ac 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 35.0.0 + */ + public function getProvider(): IOCMProvider { + return $this->provider; + } } diff --git a/openapi.json b/openapi.json index 9a7657759eeee..7e139c4126765 100644 --- a/openapi.json +++ b/openapi.json @@ -1296,15 +1296,6 @@ } } }, - "CloudFederationApiCapabilities": { - "type": "object", - "additionalProperties": { - "type": "object", - "additionalProperties": { - "type": "object" - } - } - }, "CloudFederationApiError": { "type": "object", "required": [ @@ -7164,9 +7155,6 @@ { "$ref": "#/components/schemas/CorePublicCapabilities" }, - { - "$ref": "#/components/schemas/CloudFederationApiCapabilities" - }, { "$ref": "#/components/schemas/CommentsCapabilities" }, @@ -16967,167 +16955,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", diff --git a/psalm.xml b/psalm.xml index 77861343d60d8..05720c63e0107 100644 --- a/psalm.xml +++ b/psalm.xml @@ -65,7 +65,6 @@ -