From 21b8a873d5c93e5d815fd37bfcbf1d5ed162d12d Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Tue, 12 Jun 2018 16:58:30 +0200 Subject: implement config check Signed-off-by: Bjoern Schiessle --- apps/cloud_federation_api/lib/Config.php | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'apps') diff --git a/apps/cloud_federation_api/lib/Config.php b/apps/cloud_federation_api/lib/Config.php index 90c36a4f792..386f27b199a 100644 --- a/apps/cloud_federation_api/lib/Config.php +++ b/apps/cloud_federation_api/lib/Config.php @@ -21,6 +21,8 @@ namespace OCA\CloudFederationAPI; +use OCP\GlobalScale\IConfig as IGsConfig; +use OCP\IConfig; /** @@ -32,15 +34,33 @@ namespace OCA\CloudFederationAPI; */ class Config { - public function __construct() { + /** @var IGsConfig */ + private $gsConfig; + + /** @var IConfig */ + private $config; + + public function __construct(IGsConfig $globalScaleConfig, IConfig $config) { + $this->gsConfig = $globalScaleConfig; + $this->config = $config; } public function incomingRequestsEnabled() { - return true; + if ($this->gsConfig->onlyInternalFederation()) { + return false; + } + $result = $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes'); + return ($result === 'yes'); } public function outgoingRequestsEnabled() { - return true; + + if ($this->gsConfig->onlyInternalFederation()) { + return false; + } + $result = $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes'); + return ($result === 'yes'); + } } -- cgit v1.2.3