Browse Source
feat(Reference): Add public API endpoints to get references
feat(Reference): Add public API endpoints to get references
Calling the public API endpoints will check for matching registered reference providers that implement `IPublicReferenceProvider` and call their respective functions. If no matching provider is found, the default `LinkReferenceProvider` will be used to provide open graph data. The frontend reference widget components will call these endpoints from unauthorized sessions, e.g. in public shares. If present, the sharing token of the origin URL is passed to `resolveReferencePublic()` as additional information for the reference provider to determine the access scope. This allows the respective reference providers to determine whether the origin share has access to the linked resource. `getCacheKeyPublic` also gets the sharing token so it can scope the cached entry to it. Contributes to #45978 Signed-off-by: Jonas <jonas@freesources.org>pull/46378/head
No known key found for this signature in database
GPG Key ID: 5262E7FF491049FE
9 changed files with 794 additions and 14 deletions
-
89core/Controller/ReferenceApiController.php
-
312core/openapi-full.json
-
312core/openapi.json
-
1lib/composer/composer/autoload_classmap.php
-
1lib/composer/composer/autoload_static.php
-
36lib/private/Collaboration/Reference/ReferenceManager.php
-
33lib/public/Collaboration/Reference/IPublicReferenceProvider.php
-
6lib/public/Collaboration/Reference/IReferenceManager.php
-
18lib/public/Collaboration/Reference/LinkReferenceProvider.php
@ -0,0 +1,33 @@ |
|||
<?php |
|||
|
|||
declare(strict_types=1); |
|||
/** |
|||
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors |
|||
* SPDX-License-Identifier: AGPL-3.0-or-later |
|||
*/ |
|||
|
|||
namespace OCP\Collaboration\Reference; |
|||
|
|||
/** |
|||
* @since 30.0.0 |
|||
*/ |
|||
interface IPublicReferenceProvider extends IReferenceProvider { |
|||
/** |
|||
* Return a reference with its metadata for a given reference identifier and sharingToken |
|||
* |
|||
* @since 30.0.0 |
|||
*/ |
|||
public function resolveReferencePublic(string $referenceText, string $sharingToken): ?IReference; |
|||
|
|||
/** |
|||
* Return a custom cache key to be used for caching the metadata |
|||
* This could be for example the current sharingToken if the reference |
|||
* access permissions are different for each share |
|||
* |
|||
* Should return null, if the cache is only related to the |
|||
* reference id and has no further dependency |
|||
* |
|||
* @since 30.0.0 |
|||
*/ |
|||
public function getCacheKeyPublic(string $referenceId, string $sharingToken): ?string; |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue