diff options
-rw-r--r-- | lib/private/Federation/CloudFederationProviderManager.php | 16 | ||||
-rw-r--r-- | lib/private/Server.php | 2 | ||||
-rw-r--r-- | lib/public/Federation/ICloudFederationProviderManager.php | 9 |
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(); + } |