summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2018-05-02 17:15:07 +0200
committerBjoern Schiessle <bjoern@schiessle.org>2018-07-02 11:29:27 +0200
commit6208f250e88a15794ac5b7eeef6d701aa91e131b (patch)
tree7f8a5154a9d1bf9041e0e2fe074b7f6d79b1b5be
parent4c8f3d6d77c5a6bb4a7eced86890039d15d9ca67 (diff)
downloadnextcloud-server-6208f250e88a15794ac5b7eeef6d701aa91e131b.tar.gz
nextcloud-server-6208f250e88a15794ac5b7eeef6d701aa91e131b.zip
check if cloud federation api is ready
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
-rw-r--r--lib/private/Federation/CloudFederationProviderManager.php16
-rw-r--r--lib/private/Server.php2
-rw-r--r--lib/public/Federation/ICloudFederationProviderManager.php9
3 files changed, 25 insertions, 2 deletions
diff --git a/lib/private/Federation/CloudFederationProviderManager.php b/lib/private/Federation/CloudFederationProviderManager.php
index 925d42a688a..73e1dd99c61 100644
--- a/lib/private/Federation/CloudFederationProviderManager.php
+++ b/lib/private/Federation/CloudFederationProviderManager.php
@@ -22,6 +22,7 @@
namespace OC\Federation;
+use OCP\App\IAppManager;
use OCP\Federation\Exceptions\ProviderAlreadyExistsException;
use OCP\Federation\Exceptions\ProviderDoesNotExistsException;
use OCP\Federation\ICloudFederationNotification;
@@ -41,8 +42,12 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager
/** @var array list of available cloud federation providers */
private $cloudFederationProvider;
- public function __construct() {
+ /** @var IAppManager */
+ private $appManager;
+
+ public function __construct(IAppManager $appManager) {
$this->cloudFederationProvider= [];
+ $this->appManager = $appManager;
}
@@ -105,4 +110,13 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager
// TODO: Implement sendNotification() method.
}
+ /**
+ * check if the new cloud federation API is ready to be used
+ *
+ * @return bool
+ */
+ public function isReady() {
+ return $this->appManager->isEnabledForUser('cloud_federation_api', false);
+ }
+
}
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 170bc6b2584..7156c8a2c22 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -1117,7 +1117,7 @@ class Server extends ServerContainer implements IServerContainer {
});
$this->registerService(ICloudFederationProviderManager::class, function (Server $c) {
- return new CloudFederationProviderManager();
+ return new CloudFederationProviderManager($c->getAppManager());
});
$this->registerService(ICloudFederationFactory::class, function (Server $c) {
diff --git a/lib/public/Federation/ICloudFederationProviderManager.php b/lib/public/Federation/ICloudFederationProviderManager.php
index c9789949245..81558c631f7 100644
--- a/lib/public/Federation/ICloudFederationProviderManager.php
+++ b/lib/public/Federation/ICloudFederationProviderManager.php
@@ -93,5 +93,14 @@ interface ICloudFederationProviderManager {
*/
public function sendNotification(ICloudFederationNotification $notification);
+ /**
+ * check if the new cloud federation API is ready to be used
+ *
+ * @return bool
+ *
+ * @since 14.0.0
+ */
+ public function isReady();
+
}