summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2015-09-12 16:25:23 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2015-09-15 15:10:13 +0200
commit91dfcab0553a8bbc13df4b57e9fed061741bea74 (patch)
treedc719da9a0d3416945dbfb560f38ee9fb0a6725d /apps/files_sharing
parent650e600b942d830460bb96de6726bdd1e8284a8e (diff)
downloadnextcloud-server-91dfcab0553a8bbc13df4b57e9fed061741bea74.tar.gz
nextcloud-server-91dfcab0553a8bbc13df4b57e9fed061741bea74.zip
Expose federated sharing capabilities to authenticated users
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/lib/capabilities.php7
-rw-r--r--apps/files_sharing/tests/capabilities.php35
2 files changed, 42 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/capabilities.php b/apps/files_sharing/lib/capabilities.php
index ea71c47a05c..b24eb8d61f0 100644
--- a/apps/files_sharing/lib/capabilities.php
+++ b/apps/files_sharing/lib/capabilities.php
@@ -67,6 +67,13 @@ class Capabilities implements ICapability {
$res['resharing'] = $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes') === 'yes';
+
+ //Federated sharing
+ $res['federation'] = [
+ 'outgoing' => $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes',
+ 'incoming' => $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'yes'
+ ];
+
return [
'files_sharing' => $res,
];
diff --git a/apps/files_sharing/tests/capabilities.php b/apps/files_sharing/tests/capabilities.php
index 5b9789ce324..f1a9626db9b 100644
--- a/apps/files_sharing/tests/capabilities.php
+++ b/apps/files_sharing/tests/capabilities.php
@@ -202,5 +202,40 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase {
$this->assertFalse($result['public']['upload']);
}
+ public function testFederatedSharingIncomming() {
+ $map = [
+ ['files_sharing', 'incoming_server2server_share_enabled', 'yes', 'yes'],
+ ];
+ $result = $this->getResults($map);
+ $this->assertArrayHasKey('federation', $result);
+ $this->assertTrue($result['federation']['incoming']);
+ }
+
+ public function testFederatedSharingNoIncomming() {
+ $map = [
+ ['files_sharing', 'incoming_server2server_share_enabled', 'yes', 'no'],
+ ];
+ $result = $this->getResults($map);
+ $this->assertArrayHasKey('federation', $result);
+ $this->assertFalse($result['federation']['incoming']);
+ }
+
+ public function testFederatedSharingOutgoing() {
+ $map = [
+ ['files_sharing', 'outgoing_server2server_share_enabled', 'yes', 'yes'],
+ ];
+ $result = $this->getResults($map);
+ $this->assertArrayHasKey('federation', $result);
+ $this->assertTrue($result['federation']['outgoing']);
+ }
+
+ public function testFederatedSharingNoOutgoing() {
+ $map = [
+ ['files_sharing', 'outgoing_server2server_share_enabled', 'yes', 'no'],
+ ];
+ $result = $this->getResults($map);
+ $this->assertArrayHasKey('federation', $result);
+ $this->assertFalse($result['federation']['outgoing']);
+ }
}