aboutsummaryrefslogtreecommitdiffstats
path: root/apps/federatedfilesharing/lib/FederatedShareProvider.php
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2017-05-24 09:07:58 +0200
committerBjoern Schiessle <bjoern@schiessle.org>2017-05-29 18:19:28 +0200
commit7c2d473d7686f4824d3b7f05238d262e26d5efa2 (patch)
treef4aae21880e293a2ded78e63ee3300b61b5f487f /apps/federatedfilesharing/lib/FederatedShareProvider.php
parent4be17dff0f9846d32f9740e7d7766bdbc1e98b51 (diff)
downloadnextcloud-server-7c2d473d7686f4824d3b7f05238d262e26d5efa2.tar.gz
nextcloud-server-7c2d473d7686f4824d3b7f05238d262e26d5efa2.zip
add new config switched for the global scale architecture
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps/federatedfilesharing/lib/FederatedShareProvider.php')
-rw-r--r--apps/federatedfilesharing/lib/FederatedShareProvider.php22
1 files changed, 21 insertions, 1 deletions
diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php
index 34e02391e05..60a54c6ca3c 100644
--- a/apps/federatedfilesharing/lib/FederatedShareProvider.php
+++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php
@@ -85,6 +85,9 @@ class FederatedShareProvider implements IShareProvider {
/** @var ICloudIdManager */
private $cloudIdManager;
+ /** @var \OCP\GlobalScale\IConfig */
+ private $gsConfig;
+
/**
* DefaultShareProvider constructor.
*
@@ -98,6 +101,7 @@ class FederatedShareProvider implements IShareProvider {
* @param IConfig $config
* @param IUserManager $userManager
* @param ICloudIdManager $cloudIdManager
+ * @param \OCP\GlobalScale\IConfig $globalScaleConfig
*/
public function __construct(
IDBConnection $connection,
@@ -109,7 +113,8 @@ class FederatedShareProvider implements IShareProvider {
IRootFolder $rootFolder,
IConfig $config,
IUserManager $userManager,
- ICloudIdManager $cloudIdManager
+ ICloudIdManager $cloudIdManager,
+ \OCP\GlobalScale\IConfig $globalScaleConfig
) {
$this->dbConnection = $connection;
$this->addressHandler = $addressHandler;
@@ -121,6 +126,7 @@ class FederatedShareProvider implements IShareProvider {
$this->config = $config;
$this->userManager = $userManager;
$this->cloudIdManager = $cloudIdManager;
+ $this->gsConfig = $globalScaleConfig;
}
/**
@@ -941,6 +947,9 @@ class FederatedShareProvider implements IShareProvider {
* @return bool
*/
public function isOutgoingServer2serverShareEnabled() {
+ if ($this->gsConfig->onlyInternalFederation()) {
+ return false;
+ }
$result = $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes');
return ($result === 'yes');
}
@@ -951,6 +960,9 @@ class FederatedShareProvider implements IShareProvider {
* @return bool
*/
public function isIncomingServer2serverShareEnabled() {
+ if ($this->gsConfig->onlyInternalFederation()) {
+ return false;
+ }
$result = $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes');
return ($result === 'yes');
}
@@ -961,6 +973,10 @@ class FederatedShareProvider implements IShareProvider {
* @return bool
*/
public function isLookupServerQueriesEnabled() {
+ // in a global scale setup we should always query the lookup server
+ if ($this->gsConfig->isGlobalScaleEnabled()) {
+ return true;
+ }
$result = $this->config->getAppValue('files_sharing', 'lookupServerEnabled', 'no');
return ($result === 'yes');
}
@@ -972,6 +988,10 @@ class FederatedShareProvider implements IShareProvider {
* @return bool
*/
public function isLookupServerUploadEnabled() {
+ // in a global scale setup the admin is responsible to keep the lookup server up-to-date
+ if ($this->gsConfig->isGlobalScaleEnabled()) {
+ return false;
+ }
$result = $this->config->getAppValue('files_sharing', 'lookupServerUploadEnabled', 'yes');
return ($result === 'yes');
}