Merge pull request #18986 from owncloud/federated_capabilities

Expose federated sharing capabilities to authenticated users
This commit is contained in:
Thomas Müller 2015-09-18 11:58:54 +02:00
commit 93eb73b0bb
2 changed files with 42 additions and 0 deletions

View File

@ -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,
];

View File

@ -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']);
}
}