Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
More cleaning after auto-add removal
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Apr 27, 2021
commit 1029abc8f6e6935680303ffdb57c9c6fb11c4039
1 change: 0 additions & 1 deletion apps/federation/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
'OCA\\Federation\\Controller\\SettingsController' => $baseDir . '/../lib/Controller/SettingsController.php',
'OCA\\Federation\\DAV\\FedAuth' => $baseDir . '/../lib/DAV/FedAuth.php',
'OCA\\Federation\\DbHandler' => $baseDir . '/../lib/DbHandler.php',
'OCA\\Federation\\Hooks' => $baseDir . '/../lib/Hooks.php',
'OCA\\Federation\\Listener\\SabrePluginAuthInitListener' => $baseDir . '/../lib/Listener/SabrePluginAuthInitListener.php',
'OCA\\Federation\\Middleware\\AddServerMiddleware' => $baseDir . '/../lib/Middleware/AddServerMiddleware.php',
'OCA\\Federation\\Migration\\Version1010Date20200630191302' => $baseDir . '/../lib/Migration/Version1010Date20200630191302.php',
Expand Down
1 change: 0 additions & 1 deletion apps/federation/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class ComposerStaticInitFederation
'OCA\\Federation\\Controller\\SettingsController' => __DIR__ . '/..' . '/../lib/Controller/SettingsController.php',
'OCA\\Federation\\DAV\\FedAuth' => __DIR__ . '/..' . '/../lib/DAV/FedAuth.php',
'OCA\\Federation\\DbHandler' => __DIR__ . '/..' . '/../lib/DbHandler.php',
'OCA\\Federation\\Hooks' => __DIR__ . '/..' . '/../lib/Hooks.php',
'OCA\\Federation\\Listener\\SabrePluginAuthInitListener' => __DIR__ . '/..' . '/../lib/Listener/SabrePluginAuthInitListener.php',
'OCA\\Federation\\Middleware\\AddServerMiddleware' => __DIR__ . '/..' . '/../lib/Middleware/AddServerMiddleware.php',
'OCA\\Federation\\Migration\\Version1010Date20200630191302' => __DIR__ . '/..' . '/../lib/Migration/Version1010Date20200630191302.php',
Expand Down
47 changes: 0 additions & 47 deletions apps/federation/lib/Hooks.php

This file was deleted.

1 change: 0 additions & 1 deletion apps/federation/lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public function __construct(TrustedServers $trustedServers) {
public function getForm() {
$parameters = [
'trustedServers' => $this->trustedServers->getServers(),
'autoAddServers' => $this->trustedServers->getAutoAddServers(),
];

return new TemplateResponse('federation', 'settings-admin', $parameters, '');
Expand Down
22 changes: 0 additions & 22 deletions apps/federation/lib/TrustedServers.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,28 +130,6 @@ public function addServer($url) {
return $result;
}

/**
* enable/disable to automatically add servers to the list of trusted servers
* once a federated share was created and accepted successfully
*
* @param bool $status
*/
public function setAutoAddServers($status) {
$value = $status ? '1' : '0';
$this->config->setAppValue('federation', 'autoAddServers', $value);
}

/**
* return if we automatically add servers to the list of trusted servers
* once a federated share was created and accepted successfully
*
* @return bool
*/
public function getAutoAddServers() {
$value = $this->config->getAppValue('federation', 'autoAddServers', '0');
return $value === '1';
}

/**
* get shared secret for the given server
*
Expand Down
80 changes: 0 additions & 80 deletions apps/federation/tests/HooksTest.php

This file was deleted.

5 changes: 0 additions & 5 deletions apps/federation/tests/Settings/AdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,9 @@ public function testGetForm() {
->expects($this->once())
->method('getServers')
->willReturn(['myserver', 'secondserver']);
$this->trustedServers
->expects($this->once())
->method('getAutoAddServers')
->willReturn(['autoserver1', 'autoserver2']);

$params = [
'trustedServers' => ['myserver', 'secondserver'],
'autoAddServers' => ['autoserver1', 'autoserver2'],
];
$expected = new TemplateResponse('federation', 'settings-admin', $params, '');
$this->assertEquals($expected, $this->admin->getForm());
Expand Down
39 changes: 0 additions & 39 deletions apps/federation/tests/TrustedServersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,45 +156,6 @@ public function dataTrueFalse() {
];
}

/**
* @dataProvider dataTrueFalse
*
* @param bool $status
*/
public function testSetAutoAddServers($status) {
if ($status) {
$this->config->expects($this->once())->method('setAppValue')
->with('federation', 'autoAddServers', '1');
} else {
$this->config->expects($this->once())->method('setAppValue')
->with('federation', 'autoAddServers', '0');
}

$this->trustedServers->setAutoAddServers($status);
}

/**
* @dataProvider dataTestGetAutoAddServers
*
* @param string $status
* @param bool $expected
*/
public function testGetAutoAddServers($status, $expected) {
$this->config->expects($this->once())->method('getAppValue')
->with('federation', 'autoAddServers', '0')->willReturn($status);

$this->assertSame($expected,
$this->trustedServers->getAutoAddServers()
);
}

public function dataTestGetAutoAddServers() {
return [
['1', true],
['0', false]
];
}

public function testAddSharedSecret() {
$this->dbHandler->expects($this->once())->method('addSharedSecret')
->with('url', 'secret');
Expand Down