implement config check

Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
Bjoern Schiessle 2018-06-12 16:58:30 +02:00
parent 9365fd2534
commit 21b8a873d5
No known key found for this signature in database
GPG Key ID: 2378A753E2BF04F6
1 changed files with 23 additions and 3 deletions

View File

@ -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');
}
}