diff options
author | Joas Schilling <coding@schilljs.com> | 2023-10-12 12:25:16 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-10-13 08:34:42 +0200 |
commit | b246d51cbc5105b9c4e85867297ee19f6d2459e5 (patch) | |
tree | b0551f9a6b21c5fe776a3c1cd3dee1d3be54757f /apps | |
parent | 4dbe0677ad25d9ccbc4efcdc67c0e5b3d736d70f (diff) | |
download | nextcloud-server-b246d51cbc5105b9c4e85867297ee19f6d2459e5.tar.gz nextcloud-server-b246d51cbc5105b9c4e85867297ee19f6d2459e5.zip |
fix(OCM): Make the OCM provider stateful so apps can add resources
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/cloud_federation_api/appinfo/info.xml | 4 | ||||
-rw-r--r-- | apps/cloud_federation_api/lib/Capabilities.php | 14 |
2 files changed, 9 insertions, 9 deletions
diff --git a/apps/cloud_federation_api/appinfo/info.xml b/apps/cloud_federation_api/appinfo/info.xml index f9ca8185dcf..8de2444ff2a 100644 --- a/apps/cloud_federation_api/appinfo/info.xml +++ b/apps/cloud_federation_api/appinfo/info.xml @@ -12,8 +12,8 @@ <types> <filesystem/> </types> - <category>files</category> - <bugs>https://github.com/nextcloud/cloud_federation/issues</bugs> + <category>integration</category> + <bugs>https://github.com/nextcloud/server/issues</bugs> <dependencies> <nextcloud min-version="28" max-version="28"/> </dependencies> diff --git a/apps/cloud_federation_api/lib/Capabilities.php b/apps/cloud_federation_api/lib/Capabilities.php index 1682effb145..cd44d13117a 100644 --- a/apps/cloud_federation_api/lib/Capabilities.php +++ b/apps/cloud_federation_api/lib/Capabilities.php @@ -28,11 +28,11 @@ declare(strict_types=1); namespace OCA\CloudFederationAPI; -use OC\OCM\Model\OCMProvider; use OC\OCM\Model\OCMResource; use OCP\Capabilities\ICapability; use OCP\IURLGenerator; use OCP\OCM\Exceptions\OCMArgumentException; +use OCP\OCM\IOCMProvider; class Capabilities implements ICapability { @@ -40,6 +40,7 @@ class Capabilities implements ICapability { public function __construct( private IURLGenerator $urlGenerator, + private IOCMProvider $provider, ) { } @@ -63,24 +64,23 @@ class Capabilities implements ICapability { public function getCapabilities() { $url = $this->urlGenerator->linkToRouteAbsolute('cloud_federation_api.requesthandlercontroller.addShare'); - $provider = new OCMProvider(); - $provider->setEnabled(true); - $provider->setApiVersion(self::API_VERSION); + $this->provider->setEnabled(true); + $this->provider->setApiVersion(self::API_VERSION); $pos = strrpos($url, '/'); if (false === $pos) { throw new OCMArgumentException('generated route should contains a slash character'); } - $provider->setEndPoint(substr($url, 0, $pos)); + $this->provider->setEndPoint(substr($url, 0, $pos)); $resource = new OCMResource(); $resource->setName('file') ->setShareTypes(['user', 'group']) ->setProtocols(['webdav' => '/public.php/webdav/']); - $provider->setResourceTypes([$resource]); + $this->provider->setResourceTypes([$resource]); - return ['ocm' => $provider->jsonSerialize()]; + return ['ocm' => $this->provider->jsonSerialize()]; } } |