check if cloud federation api is ready
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
parent
4c8f3d6d77
commit
6208f250e8
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue