diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-09-18 11:58:54 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-09-18 11:58:54 +0200 |
commit | 93eb73b0bbc2471bddbeda17deac071f9848e75d (patch) | |
tree | e7e3392fcd052b7eba4c92f213fec6af34575731 /apps | |
parent | 0c37a28a6046f1051ea2a0d8665cfc35bd84ea39 (diff) | |
parent | 91dfcab0553a8bbc13df4b57e9fed061741bea74 (diff) | |
download | nextcloud-server-93eb73b0bbc2471bddbeda17deac071f9848e75d.tar.gz nextcloud-server-93eb73b0bbc2471bddbeda17deac071f9848e75d.zip |
Merge pull request #18986 from owncloud/federated_capabilities
Expose federated sharing capabilities to authenticated users
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/lib/capabilities.php | 7 | ||||
-rw-r--r-- | apps/files_sharing/tests/capabilities.php | 35 |
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']); + } } |