aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r--apps/files_sharing/lib/Capabilities.php28
-rw-r--r--apps/files_sharing/lib/Listener/LoadSidebarListener.php12
2 files changed, 28 insertions, 12 deletions
diff --git a/apps/files_sharing/lib/Capabilities.php b/apps/files_sharing/lib/Capabilities.php
index b4fe5a1bb73..cbb9b5cd2f2 100644
--- a/apps/files_sharing/lib/Capabilities.php
+++ b/apps/files_sharing/lib/Capabilities.php
@@ -7,6 +7,7 @@
*/
namespace OCA\Files_Sharing;
+use OCP\App\IAppManager;
use OCP\Capabilities\ICapability;
use OCP\Constants;
use OCP\IConfig;
@@ -18,10 +19,10 @@ use OCP\Share\IManager;
* @package OCA\Files_Sharing
*/
class Capabilities implements ICapability {
-
public function __construct(
private IConfig $config,
private IManager $shareManager,
+ private IAppManager $appManager,
) {
}
@@ -158,14 +159,23 @@ class Capabilities implements ICapability {
}
//Federated sharing
- $res['federation'] = [
- 'outgoing' => $this->shareManager->outgoingServer2ServerSharesAllowed(),
- 'incoming' => $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'yes',
- // old bogus one, expire_date was not working before, keeping for compatibility
- 'expire_date' => ['enabled' => true],
- // the real deal, signifies that expiration date can be set on federated shares
- 'expire_date_supported' => ['enabled' => true],
- ];
+ if ($this->appManager->isEnabledForAnyone('federation')) {
+ $res['federation'] = [
+ 'outgoing' => $this->shareManager->outgoingServer2ServerSharesAllowed(),
+ 'incoming' => $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'yes',
+ // old bogus one, expire_date was not working before, keeping for compatibility
+ 'expire_date' => ['enabled' => true],
+ // the real deal, signifies that expiration date can be set on federated shares
+ 'expire_date_supported' => ['enabled' => true],
+ ];
+ } else {
+ $res['federation'] = [
+ 'outgoing' => false,
+ 'incoming' => false,
+ 'expire_date' => ['enabled' => false],
+ 'expire_date_supported' => ['enabled' => false],
+ ];
+ }
// Sharee searches
$res['sharee'] = [
diff --git a/apps/files_sharing/lib/Listener/LoadSidebarListener.php b/apps/files_sharing/lib/Listener/LoadSidebarListener.php
index 88c39f38545..17fee71978f 100644
--- a/apps/files_sharing/lib/Listener/LoadSidebarListener.php
+++ b/apps/files_sharing/lib/Listener/LoadSidebarListener.php
@@ -15,6 +15,7 @@ use OCA\Files_Sharing\Config\ConfigLexicon;
use OCP\AppFramework\Services\IInitialState;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
+use OCP\GlobalScale\IConfig;
use OCP\IAppConfig;
use OCP\Server;
use OCP\Share\IManager;
@@ -35,10 +36,15 @@ class LoadSidebarListener implements IEventListener {
if (!($event instanceof LoadSidebar)) {
return;
}
+ Util::addScript(Application::APP_ID, 'files_sharing_tab', 'files');
$appConfig = Server::get(IAppConfig::class);
- $this->initialState->provideInitialState('showFederatedSharesAsInternal', $appConfig->getValueBool('files_sharing', ConfigLexicon::SHOW_FEDERATED_AS_INTERNAL));
- $this->initialState->provideInitialState('showFederatedSharesToTrustedServersAsInternal', $appConfig->getValueBool('files_sharing', ConfigLexicon::SHOW_FEDERATED_TO_TRUSTED_AS_INTERNAL));
- Util::addScript(Application::APP_ID, 'files_sharing_tab', 'files');
+ $gsConfig = Server::get(IConfig::class);
+ $showFederatedToTrustedAsInternal = $gsConfig->isGlobalScaleEnabled() || $appConfig->getValueBool('files_sharing', ConfigLexicon::SHOW_FEDERATED_TO_TRUSTED_AS_INTERNAL);
+ $showFederatedAsInternal = ($gsConfig->isGlobalScaleEnabled() && $gsConfig->onlyInternalFederation())
+ || $appConfig->getValueBool('files_sharing', ConfigLexicon::SHOW_FEDERATED_AS_INTERNAL);
+
+ $this->initialState->provideInitialState('showFederatedSharesAsInternal', $showFederatedAsInternal);
+ $this->initialState->provideInitialState('showFederatedSharesToTrustedServersAsInternal', $showFederatedToTrustedAsInternal);
}
}