summaryrefslogtreecommitdiffstats
path: root/apps/federation/lib/trustedservers.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/federation/lib/trustedservers.php')
-rw-r--r--apps/federation/lib/trustedservers.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/apps/federation/lib/trustedservers.php b/apps/federation/lib/trustedservers.php
index 340accfdbdf..6f99a3c6a8c 100644
--- a/apps/federation/lib/trustedservers.php
+++ b/apps/federation/lib/trustedservers.php
@@ -30,6 +30,8 @@ use OCP\Http\Client\IClientService;
use OCP\IConfig;
use OCP\ILogger;
use OCP\Security\ISecureRandom;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
+use Symfony\Component\EventDispatcher\GenericEvent;
class TrustedServers {
@@ -39,6 +41,8 @@ class TrustedServers {
const STATUS_PENDING = 2;
/** something went wrong, misconfigured server, software bug,... user interaction needed */
const STATUS_FAILURE = 3;
+ /** remote server revoked access */
+ const STATUS_ACCESS_REVOKED = 4;
/** @var dbHandler */
private $dbHandler;
@@ -58,6 +62,9 @@ class TrustedServers {
/** @var IConfig */
private $config;
+ /** @var EventDispatcherInterface */
+ private $dispatcher;
+
/**
* @param DbHandler $dbHandler
* @param IClientService $httpClientService
@@ -65,6 +72,7 @@ class TrustedServers {
* @param IJobList $jobList
* @param ISecureRandom $secureRandom
* @param IConfig $config
+ * @param EventDispatcherInterface $dispatcher
*/
public function __construct(
DbHandler $dbHandler,
@@ -72,7 +80,8 @@ class TrustedServers {
ILogger $logger,
IJobList $jobList,
ISecureRandom $secureRandom,
- IConfig $config
+ IConfig $config,
+ EventDispatcherInterface $dispatcher
) {
$this->dbHandler = $dbHandler;
$this->httpClientService = $httpClientService;
@@ -80,6 +89,7 @@ class TrustedServers {
$this->jobList = $jobList;
$this->secureRandom = $secureRandom;
$this->config = $config;
+ $this->dispatcher = $dispatcher;
}
/**
@@ -154,7 +164,10 @@ class TrustedServers {
* @param int $id
*/
public function removeServer($id) {
+ $server = $this->dbHandler->getServerById($id);
$this->dbHandler->removeServer($id);
+ $event = new GenericEvent($server['url_hash']);
+ $this->dispatcher->dispatch('OCP\Federation\TrustedServerEvent::remove', $event);
}
/**
@@ -222,6 +235,7 @@ class TrustedServers {
*
* @param $status
* @return bool
+ * @throws HintException
*/
protected function checkOwnCloudVersion($status) {
$decoded = json_decode($status, true);