summaryrefslogtreecommitdiffstats
path: root/apps/cloud_federation_api
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2018-06-13 14:46:23 +0200
committerBjoern Schiessle <bjoern@schiessle.org>2018-07-02 11:29:31 +0200
commit8d4da30bf59ca12a81f13ea93b7fdd6c84cb1c2b (patch)
treef75a4963116fad8d33513f1a84f033e38cc9b3d4 /apps/cloud_federation_api
parente251b34a8c5ba0c06ff8eecf73374895180f7d03 (diff)
downloadnextcloud-server-8d4da30bf59ca12a81f13ea93b7fdd6c84cb1c2b.tar.gz
nextcloud-server-8d4da30bf59ca12a81f13ea93b7fdd6c84cb1c2b.zip
add support for different share types
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps/cloud_federation_api')
-rw-r--r--apps/cloud_federation_api/lib/Config.php39
1 files changed, 15 insertions, 24 deletions
diff --git a/apps/cloud_federation_api/lib/Config.php b/apps/cloud_federation_api/lib/Config.php
index 386f27b199a..7d42960deaf 100644
--- a/apps/cloud_federation_api/lib/Config.php
+++ b/apps/cloud_federation_api/lib/Config.php
@@ -21,6 +21,7 @@
namespace OCA\CloudFederationAPI;
+use OCP\Federation\ICloudFederationProviderManager;
use OCP\GlobalScale\IConfig as IGsConfig;
use OCP\IConfig;
@@ -34,33 +35,23 @@ use OCP\IConfig;
*/
class Config {
- /** @var IGsConfig */
- private $gsConfig;
+ /** @var ICloudFederationProviderManager */
+ private $cloudFederationProviderManager;
- /** @var IConfig */
- private $config;
-
- public function __construct(IGsConfig $globalScaleConfig, IConfig $config) {
- $this->gsConfig = $globalScaleConfig;
- $this->config = $config;
- }
-
- public function incomingRequestsEnabled() {
- if ($this->gsConfig->onlyInternalFederation()) {
- return false;
- }
- $result = $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes');
- return ($result === 'yes');
+ public function __construct(ICloudFederationProviderManager $cloudFederationProviderManager) {
+ $this->cloudFederationProviderManager = $cloudFederationProviderManager;
}
- public function outgoingRequestsEnabled() {
-
- if ($this->gsConfig->onlyInternalFederation()) {
- return false;
- }
- $result = $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes');
- return ($result === 'yes');
-
+ /**
+ * get a list of supported share types
+ *
+ * @param string $resourceType
+ * @return array
+ * @throws \OCP\Federation\Exceptions\ProviderDoesNotExistsException
+ */
+ public function getSupportedShareTypes($resourceType) {
+ $provider = $this->cloudFederationProviderManager->getCloudFederationProvider($resourceType);
+ return $provider->getSupportedShareTypes();
}
}