2018-04-30 10:29:56 -04:00
|
|
|
<?php
|
|
|
|
|
/**
|
2024-05-27 11:39:07 -04:00
|
|
|
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2018-04-30 10:29:56 -04:00
|
|
|
*/
|
|
|
|
|
namespace OCA\CloudFederationAPI;
|
2020-04-09 05:48:10 -04:00
|
|
|
|
2018-06-13 08:46:23 -04:00
|
|
|
use OCP\Federation\ICloudFederationProviderManager;
|
2025-04-24 06:08:57 -04:00
|
|
|
use Psr\Log\LoggerInterface;
|
2018-04-30 10:29:56 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class config
|
|
|
|
|
*
|
|
|
|
|
* handles all the config parameters
|
|
|
|
|
*
|
|
|
|
|
* @package OCA\CloudFederationAPI
|
|
|
|
|
*/
|
|
|
|
|
class Config {
|
|
|
|
|
|
2024-10-18 06:04:22 -04:00
|
|
|
public function __construct(
|
|
|
|
|
private ICloudFederationProviderManager $cloudFederationProviderManager,
|
2025-04-24 06:08:57 -04:00
|
|
|
private LoggerInterface $logger,
|
2024-10-18 06:04:22 -04:00
|
|
|
) {
|
2018-04-30 10:29:56 -04:00
|
|
|
}
|
|
|
|
|
|
2018-06-13 08:46:23 -04:00
|
|
|
/**
|
|
|
|
|
* get a list of supported share types
|
|
|
|
|
*
|
|
|
|
|
* @param string $resourceType
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
public function getSupportedShareTypes($resourceType) {
|
2018-06-13 08:19:59 -04:00
|
|
|
try {
|
|
|
|
|
$provider = $this->cloudFederationProviderManager->getCloudFederationProvider($resourceType);
|
|
|
|
|
return $provider->getSupportedShareTypes();
|
|
|
|
|
} catch (\Exception $e) {
|
2025-04-24 06:08:57 -04:00
|
|
|
$this->logger->error('Failed to create federation provider', ['exception' => $e]);
|
2018-06-13 08:19:59 -04:00
|
|
|
return [];
|
|
|
|
|
}
|
2018-04-30 10:29:56 -04:00
|
|
|
}
|
|
|
|
|
}
|