From 7b3855a3752053a440837fe0999e99cff7291dbc Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Fri, 18 Nov 2016 17:39:08 +0100 Subject: Add config switch Signed-off-by: Lukas Reschke --- apps/federatedfilesharing/lib/FederatedShareProvider.php | 10 ++++++++++ apps/federatedfilesharing/lib/Settings/Admin.php | 1 + apps/federatedfilesharing/templates/settings-admin.php | 7 +++++++ apps/federatedfilesharing/tests/Settings/AdminTest.php | 5 +++++ 4 files changed, 23 insertions(+) (limited to 'apps/federatedfilesharing') diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php index 6481abe32e2..61f1b1c8f18 100644 --- a/apps/federatedfilesharing/lib/FederatedShareProvider.php +++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php @@ -943,4 +943,14 @@ class FederatedShareProvider implements IShareProvider { $result = $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes'); return ($result === 'yes') ? true : false; } + + /** + * Check if querying sharees on the lookup server is enabled + * + * @return bool + */ + public function isLookupServerQueriesEnabled() { + $result = $this->config->getAppValue('files_sharing', 'lookupServerEnabled', 'no'); + return ($result === 'yes') ? true : false; + } } diff --git a/apps/federatedfilesharing/lib/Settings/Admin.php b/apps/federatedfilesharing/lib/Settings/Admin.php index 64619e329f3..20ff6ae6f4a 100644 --- a/apps/federatedfilesharing/lib/Settings/Admin.php +++ b/apps/federatedfilesharing/lib/Settings/Admin.php @@ -43,6 +43,7 @@ class Admin implements ISettings { $parameters = [ 'outgoingServer2serverShareEnabled' => $this->fedShareProvider->isOutgoingServer2serverShareEnabled(), 'incomingServer2serverShareEnabled' => $this->fedShareProvider->isIncomingServer2serverShareEnabled(), + 'lookupServerEnabled' => $this->fedShareProvider->isLookupServerQueriesEnabled(), ]; return new TemplateResponse('federatedfilesharing', 'settings-admin', $parameters, ''); diff --git a/apps/federatedfilesharing/templates/settings-admin.php b/apps/federatedfilesharing/templates/settings-admin.php index 3ffd4bd5b27..0670553e061 100644 --- a/apps/federatedfilesharing/templates/settings-admin.php +++ b/apps/federatedfilesharing/templates/settings-admin.php @@ -25,4 +25,11 @@ script('federatedfilesharing', 'settings-admin'); t('Allow users on this server to receive shares from other servers'));?>

+

+ /> +
+

diff --git a/apps/federatedfilesharing/tests/Settings/AdminTest.php b/apps/federatedfilesharing/tests/Settings/AdminTest.php index 60fadca7b56..c0b35a6427b 100644 --- a/apps/federatedfilesharing/tests/Settings/AdminTest.php +++ b/apps/federatedfilesharing/tests/Settings/AdminTest.php @@ -65,10 +65,15 @@ class AdminTest extends TestCase { ->expects($this->once()) ->method('isIncomingServer2serverShareEnabled') ->willReturn($state); + $this->federatedShareProvider + ->expects($this->once()) + ->method('isLookupServerQueriesEnabled') + ->willReturn($state); $params = [ 'outgoingServer2serverShareEnabled' => $state, 'incomingServer2serverShareEnabled' => $state, + 'lookupServerEnabled' => $state, ]; $expected = new TemplateResponse('federatedfilesharing', 'settings-admin', $params, ''); $this->assertEquals($expected, $this->admin->getForm()); -- cgit v1.2.3