@@ -6,43 +6,43 @@ |
||
6 | 6 | |
7 | 7 | class ComposerStaticInitFederation |
8 | 8 | { |
9 | - public static $prefixLengthsPsr4 = array ( |
|
9 | + public static $prefixLengthsPsr4 = array( |
|
10 | 10 | 'O' => |
11 | - array ( |
|
11 | + array( |
|
12 | 12 | 'OCA\\Federation\\' => 15, |
13 | 13 | ), |
14 | 14 | ); |
15 | 15 | |
16 | - public static $prefixDirsPsr4 = array ( |
|
16 | + public static $prefixDirsPsr4 = array( |
|
17 | 17 | 'OCA\\Federation\\' => |
18 | - array ( |
|
19 | - 0 => __DIR__ . '/..' . '/../lib', |
|
18 | + array( |
|
19 | + 0 => __DIR__.'/..'.'/../lib', |
|
20 | 20 | ), |
21 | 21 | ); |
22 | 22 | |
23 | - public static $classMap = array ( |
|
24 | - 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', |
|
25 | - 'OCA\\Federation\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php', |
|
26 | - 'OCA\\Federation\\BackgroundJob\\GetSharedSecret' => __DIR__ . '/..' . '/../lib/BackgroundJob/GetSharedSecret.php', |
|
27 | - 'OCA\\Federation\\BackgroundJob\\RequestSharedSecret' => __DIR__ . '/..' . '/../lib/BackgroundJob/RequestSharedSecret.php', |
|
28 | - 'OCA\\Federation\\Command\\SyncFederationAddressBooks' => __DIR__ . '/..' . '/../lib/Command/SyncFederationAddressBooks.php', |
|
29 | - 'OCA\\Federation\\Controller\\OCSAuthAPIController' => __DIR__ . '/..' . '/../lib/Controller/OCSAuthAPIController.php', |
|
30 | - 'OCA\\Federation\\Controller\\SettingsController' => __DIR__ . '/..' . '/../lib/Controller/SettingsController.php', |
|
31 | - 'OCA\\Federation\\DAV\\FedAuth' => __DIR__ . '/..' . '/../lib/DAV/FedAuth.php', |
|
32 | - 'OCA\\Federation\\DbHandler' => __DIR__ . '/..' . '/../lib/DbHandler.php', |
|
33 | - 'OCA\\Federation\\Hooks' => __DIR__ . '/..' . '/../lib/Hooks.php', |
|
34 | - 'OCA\\Federation\\Listener\\SabrePluginAuthInitListener' => __DIR__ . '/..' . '/../lib/Listener/SabrePluginAuthInitListener.php', |
|
35 | - 'OCA\\Federation\\Middleware\\AddServerMiddleware' => __DIR__ . '/..' . '/../lib/Middleware/AddServerMiddleware.php', |
|
36 | - 'OCA\\Federation\\Migration\\Version1010Date20200630191302' => __DIR__ . '/..' . '/../lib/Migration/Version1010Date20200630191302.php', |
|
37 | - 'OCA\\Federation\\Settings\\Admin' => __DIR__ . '/..' . '/../lib/Settings/Admin.php', |
|
38 | - 'OCA\\Federation\\SyncFederationAddressBooks' => __DIR__ . '/..' . '/../lib/SyncFederationAddressBooks.php', |
|
39 | - 'OCA\\Federation\\SyncJob' => __DIR__ . '/..' . '/../lib/SyncJob.php', |
|
40 | - 'OCA\\Federation\\TrustedServers' => __DIR__ . '/..' . '/../lib/TrustedServers.php', |
|
23 | + public static $classMap = array( |
|
24 | + 'Composer\\InstalledVersions' => __DIR__.'/..'.'/composer/InstalledVersions.php', |
|
25 | + 'OCA\\Federation\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php', |
|
26 | + 'OCA\\Federation\\BackgroundJob\\GetSharedSecret' => __DIR__.'/..'.'/../lib/BackgroundJob/GetSharedSecret.php', |
|
27 | + 'OCA\\Federation\\BackgroundJob\\RequestSharedSecret' => __DIR__.'/..'.'/../lib/BackgroundJob/RequestSharedSecret.php', |
|
28 | + 'OCA\\Federation\\Command\\SyncFederationAddressBooks' => __DIR__.'/..'.'/../lib/Command/SyncFederationAddressBooks.php', |
|
29 | + 'OCA\\Federation\\Controller\\OCSAuthAPIController' => __DIR__.'/..'.'/../lib/Controller/OCSAuthAPIController.php', |
|
30 | + 'OCA\\Federation\\Controller\\SettingsController' => __DIR__.'/..'.'/../lib/Controller/SettingsController.php', |
|
31 | + 'OCA\\Federation\\DAV\\FedAuth' => __DIR__.'/..'.'/../lib/DAV/FedAuth.php', |
|
32 | + 'OCA\\Federation\\DbHandler' => __DIR__.'/..'.'/../lib/DbHandler.php', |
|
33 | + 'OCA\\Federation\\Hooks' => __DIR__.'/..'.'/../lib/Hooks.php', |
|
34 | + 'OCA\\Federation\\Listener\\SabrePluginAuthInitListener' => __DIR__.'/..'.'/../lib/Listener/SabrePluginAuthInitListener.php', |
|
35 | + 'OCA\\Federation\\Middleware\\AddServerMiddleware' => __DIR__.'/..'.'/../lib/Middleware/AddServerMiddleware.php', |
|
36 | + 'OCA\\Federation\\Migration\\Version1010Date20200630191302' => __DIR__.'/..'.'/../lib/Migration/Version1010Date20200630191302.php', |
|
37 | + 'OCA\\Federation\\Settings\\Admin' => __DIR__.'/..'.'/../lib/Settings/Admin.php', |
|
38 | + 'OCA\\Federation\\SyncFederationAddressBooks' => __DIR__.'/..'.'/../lib/SyncFederationAddressBooks.php', |
|
39 | + 'OCA\\Federation\\SyncJob' => __DIR__.'/..'.'/../lib/SyncJob.php', |
|
40 | + 'OCA\\Federation\\TrustedServers' => __DIR__.'/..'.'/../lib/TrustedServers.php', |
|
41 | 41 | ); |
42 | 42 | |
43 | 43 | public static function getInitializer(ClassLoader $loader) |
44 | 44 | { |
45 | - return \Closure::bind(function () use ($loader) { |
|
45 | + return \Closure::bind(function() use ($loader) { |
|
46 | 46 | $loader->prefixLengthsPsr4 = ComposerStaticInitFederation::$prefixLengthsPsr4; |
47 | 47 | $loader->prefixDirsPsr4 = ComposerStaticInitFederation::$prefixDirsPsr4; |
48 | 48 | $loader->classMap = ComposerStaticInitFederation::$classMap; |
@@ -6,21 +6,21 @@ |
||
6 | 6 | $baseDir = $vendorDir; |
7 | 7 | |
8 | 8 | return array( |
9 | - 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', |
|
10 | - 'OCA\\Federation\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php', |
|
11 | - 'OCA\\Federation\\BackgroundJob\\GetSharedSecret' => $baseDir . '/../lib/BackgroundJob/GetSharedSecret.php', |
|
12 | - 'OCA\\Federation\\BackgroundJob\\RequestSharedSecret' => $baseDir . '/../lib/BackgroundJob/RequestSharedSecret.php', |
|
13 | - 'OCA\\Federation\\Command\\SyncFederationAddressBooks' => $baseDir . '/../lib/Command/SyncFederationAddressBooks.php', |
|
14 | - 'OCA\\Federation\\Controller\\OCSAuthAPIController' => $baseDir . '/../lib/Controller/OCSAuthAPIController.php', |
|
15 | - 'OCA\\Federation\\Controller\\SettingsController' => $baseDir . '/../lib/Controller/SettingsController.php', |
|
16 | - 'OCA\\Federation\\DAV\\FedAuth' => $baseDir . '/../lib/DAV/FedAuth.php', |
|
17 | - 'OCA\\Federation\\DbHandler' => $baseDir . '/../lib/DbHandler.php', |
|
18 | - 'OCA\\Federation\\Hooks' => $baseDir . '/../lib/Hooks.php', |
|
19 | - 'OCA\\Federation\\Listener\\SabrePluginAuthInitListener' => $baseDir . '/../lib/Listener/SabrePluginAuthInitListener.php', |
|
20 | - 'OCA\\Federation\\Middleware\\AddServerMiddleware' => $baseDir . '/../lib/Middleware/AddServerMiddleware.php', |
|
21 | - 'OCA\\Federation\\Migration\\Version1010Date20200630191302' => $baseDir . '/../lib/Migration/Version1010Date20200630191302.php', |
|
22 | - 'OCA\\Federation\\Settings\\Admin' => $baseDir . '/../lib/Settings/Admin.php', |
|
23 | - 'OCA\\Federation\\SyncFederationAddressBooks' => $baseDir . '/../lib/SyncFederationAddressBooks.php', |
|
24 | - 'OCA\\Federation\\SyncJob' => $baseDir . '/../lib/SyncJob.php', |
|
25 | - 'OCA\\Federation\\TrustedServers' => $baseDir . '/../lib/TrustedServers.php', |
|
9 | + 'Composer\\InstalledVersions' => $vendorDir.'/composer/InstalledVersions.php', |
|
10 | + 'OCA\\Federation\\AppInfo\\Application' => $baseDir.'/../lib/AppInfo/Application.php', |
|
11 | + 'OCA\\Federation\\BackgroundJob\\GetSharedSecret' => $baseDir.'/../lib/BackgroundJob/GetSharedSecret.php', |
|
12 | + 'OCA\\Federation\\BackgroundJob\\RequestSharedSecret' => $baseDir.'/../lib/BackgroundJob/RequestSharedSecret.php', |
|
13 | + 'OCA\\Federation\\Command\\SyncFederationAddressBooks' => $baseDir.'/../lib/Command/SyncFederationAddressBooks.php', |
|
14 | + 'OCA\\Federation\\Controller\\OCSAuthAPIController' => $baseDir.'/../lib/Controller/OCSAuthAPIController.php', |
|
15 | + 'OCA\\Federation\\Controller\\SettingsController' => $baseDir.'/../lib/Controller/SettingsController.php', |
|
16 | + 'OCA\\Federation\\DAV\\FedAuth' => $baseDir.'/../lib/DAV/FedAuth.php', |
|
17 | + 'OCA\\Federation\\DbHandler' => $baseDir.'/../lib/DbHandler.php', |
|
18 | + 'OCA\\Federation\\Hooks' => $baseDir.'/../lib/Hooks.php', |
|
19 | + 'OCA\\Federation\\Listener\\SabrePluginAuthInitListener' => $baseDir.'/../lib/Listener/SabrePluginAuthInitListener.php', |
|
20 | + 'OCA\\Federation\\Middleware\\AddServerMiddleware' => $baseDir.'/../lib/Middleware/AddServerMiddleware.php', |
|
21 | + 'OCA\\Federation\\Migration\\Version1010Date20200630191302' => $baseDir.'/../lib/Migration/Version1010Date20200630191302.php', |
|
22 | + 'OCA\\Federation\\Settings\\Admin' => $baseDir.'/../lib/Settings/Admin.php', |
|
23 | + 'OCA\\Federation\\SyncFederationAddressBooks' => $baseDir.'/../lib/SyncFederationAddressBooks.php', |
|
24 | + 'OCA\\Federation\\SyncJob' => $baseDir.'/../lib/SyncJob.php', |
|
25 | + 'OCA\\Federation\\TrustedServers' => $baseDir.'/../lib/TrustedServers.php', |
|
26 | 26 | ); |
@@ -16,10 +16,10 @@ |
||
16 | 16 | <?php if ((int)$trustedServer['status'] === TrustedServers::STATUS_OK) { ?> |
17 | 17 | <span class="status success"></span> |
18 | 18 | <?php |
19 | - } elseif ( |
|
20 | - (int)$trustedServer['status'] === TrustedServers::STATUS_PENDING || |
|
21 | - (int)$trustedServer['status'] === TrustedServers::STATUS_ACCESS_REVOKED |
|
22 | - ) { ?> |
|
19 | + } elseif ( |
|
20 | + (int)$trustedServer['status'] === TrustedServers::STATUS_PENDING || |
|
21 | + (int)$trustedServer['status'] === TrustedServers::STATUS_ACCESS_REVOKED |
|
22 | + ) { ?> |
|
23 | 23 | <span class="status indeterminate"></span> |
24 | 24 | <?php } else {?> |
25 | 25 | <span class="status error"></span> |
@@ -23,42 +23,42 @@ |
||
23 | 23 | */ |
24 | 24 | |
25 | 25 | return [ |
26 | - 'routes' => [ |
|
27 | - [ |
|
28 | - 'name' => 'Settings#addServer', |
|
29 | - 'url' => '/trusted-servers', |
|
30 | - 'verb' => 'POST' |
|
31 | - ], |
|
32 | - [ |
|
33 | - 'name' => 'Settings#removeServer', |
|
34 | - 'url' => '/trusted-servers/{id}', |
|
35 | - 'verb' => 'DELETE' |
|
36 | - ], |
|
37 | - ], |
|
38 | - 'ocs' => [ |
|
39 | - // old endpoints, only used by Nextcloud and ownCloud |
|
40 | - [ |
|
41 | - 'name' => 'OCSAuthAPI#getSharedSecretLegacy', |
|
42 | - 'url' => '/api/v1/shared-secret', |
|
43 | - 'verb' => 'GET', |
|
44 | - ], |
|
45 | - [ |
|
46 | - 'name' => 'OCSAuthAPI#requestSharedSecretLegacy', |
|
47 | - 'url' => '/api/v1/request-shared-secret', |
|
48 | - 'verb' => 'POST', |
|
49 | - ], |
|
50 | - // new endpoints, published as public api |
|
51 | - [ |
|
52 | - 'name' => 'OCSAuthAPI#getSharedSecret', |
|
53 | - 'root' => '/cloud', |
|
54 | - 'url' => '/shared-secret', |
|
55 | - 'verb' => 'GET', |
|
56 | - ], |
|
57 | - [ |
|
58 | - 'name' => 'OCSAuthAPI#requestSharedSecret', |
|
59 | - 'root' => '/cloud', |
|
60 | - 'url' => '/shared-secret', |
|
61 | - 'verb' => 'POST', |
|
62 | - ], |
|
63 | - ], |
|
26 | + 'routes' => [ |
|
27 | + [ |
|
28 | + 'name' => 'Settings#addServer', |
|
29 | + 'url' => '/trusted-servers', |
|
30 | + 'verb' => 'POST' |
|
31 | + ], |
|
32 | + [ |
|
33 | + 'name' => 'Settings#removeServer', |
|
34 | + 'url' => '/trusted-servers/{id}', |
|
35 | + 'verb' => 'DELETE' |
|
36 | + ], |
|
37 | + ], |
|
38 | + 'ocs' => [ |
|
39 | + // old endpoints, only used by Nextcloud and ownCloud |
|
40 | + [ |
|
41 | + 'name' => 'OCSAuthAPI#getSharedSecretLegacy', |
|
42 | + 'url' => '/api/v1/shared-secret', |
|
43 | + 'verb' => 'GET', |
|
44 | + ], |
|
45 | + [ |
|
46 | + 'name' => 'OCSAuthAPI#requestSharedSecretLegacy', |
|
47 | + 'url' => '/api/v1/request-shared-secret', |
|
48 | + 'verb' => 'POST', |
|
49 | + ], |
|
50 | + // new endpoints, published as public api |
|
51 | + [ |
|
52 | + 'name' => 'OCSAuthAPI#getSharedSecret', |
|
53 | + 'root' => '/cloud', |
|
54 | + 'url' => '/shared-secret', |
|
55 | + 'verb' => 'GET', |
|
56 | + ], |
|
57 | + [ |
|
58 | + 'name' => 'OCSAuthAPI#requestSharedSecret', |
|
59 | + 'root' => '/cloud', |
|
60 | + 'url' => '/shared-secret', |
|
61 | + 'verb' => 'POST', |
|
62 | + ], |
|
63 | + ], |
|
64 | 64 | ]; |
@@ -33,80 +33,80 @@ |
||
33 | 33 | |
34 | 34 | class SettingsController extends Controller { |
35 | 35 | |
36 | - /** @var IL10N */ |
|
37 | - private $l; |
|
36 | + /** @var IL10N */ |
|
37 | + private $l; |
|
38 | 38 | |
39 | - /** @var TrustedServers */ |
|
40 | - private $trustedServers; |
|
39 | + /** @var TrustedServers */ |
|
40 | + private $trustedServers; |
|
41 | 41 | |
42 | - /** |
|
43 | - * @param string $AppName |
|
44 | - * @param IRequest $request |
|
45 | - * @param IL10N $l10n |
|
46 | - * @param TrustedServers $trustedServers |
|
47 | - */ |
|
48 | - public function __construct($AppName, |
|
49 | - IRequest $request, |
|
50 | - IL10N $l10n, |
|
51 | - TrustedServers $trustedServers |
|
52 | - ) { |
|
53 | - parent::__construct($AppName, $request); |
|
54 | - $this->l = $l10n; |
|
55 | - $this->trustedServers = $trustedServers; |
|
56 | - } |
|
42 | + /** |
|
43 | + * @param string $AppName |
|
44 | + * @param IRequest $request |
|
45 | + * @param IL10N $l10n |
|
46 | + * @param TrustedServers $trustedServers |
|
47 | + */ |
|
48 | + public function __construct($AppName, |
|
49 | + IRequest $request, |
|
50 | + IL10N $l10n, |
|
51 | + TrustedServers $trustedServers |
|
52 | + ) { |
|
53 | + parent::__construct($AppName, $request); |
|
54 | + $this->l = $l10n; |
|
55 | + $this->trustedServers = $trustedServers; |
|
56 | + } |
|
57 | 57 | |
58 | 58 | |
59 | - /** |
|
60 | - * add server to the list of trusted Nextclouds |
|
61 | - * |
|
62 | - * @param string $url |
|
63 | - * @return DataResponse |
|
64 | - * @throws HintException |
|
65 | - */ |
|
66 | - public function addServer($url) { |
|
67 | - $this->checkServer($url); |
|
68 | - $id = $this->trustedServers->addServer($url); |
|
59 | + /** |
|
60 | + * add server to the list of trusted Nextclouds |
|
61 | + * |
|
62 | + * @param string $url |
|
63 | + * @return DataResponse |
|
64 | + * @throws HintException |
|
65 | + */ |
|
66 | + public function addServer($url) { |
|
67 | + $this->checkServer($url); |
|
68 | + $id = $this->trustedServers->addServer($url); |
|
69 | 69 | |
70 | - return new DataResponse( |
|
71 | - [ |
|
72 | - 'url' => $url, |
|
73 | - 'id' => $id, |
|
74 | - 'message' => $this->l->t('Added to the list of trusted servers') |
|
75 | - ] |
|
76 | - ); |
|
77 | - } |
|
70 | + return new DataResponse( |
|
71 | + [ |
|
72 | + 'url' => $url, |
|
73 | + 'id' => $id, |
|
74 | + 'message' => $this->l->t('Added to the list of trusted servers') |
|
75 | + ] |
|
76 | + ); |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * add server to the list of trusted Nextclouds |
|
81 | - * |
|
82 | - * @param int $id |
|
83 | - * @return DataResponse |
|
84 | - */ |
|
85 | - public function removeServer($id) { |
|
86 | - $this->trustedServers->removeServer($id); |
|
87 | - return new DataResponse(); |
|
88 | - } |
|
79 | + /** |
|
80 | + * add server to the list of trusted Nextclouds |
|
81 | + * |
|
82 | + * @param int $id |
|
83 | + * @return DataResponse |
|
84 | + */ |
|
85 | + public function removeServer($id) { |
|
86 | + $this->trustedServers->removeServer($id); |
|
87 | + return new DataResponse(); |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * check if the server should be added to the list of trusted servers or not |
|
92 | - * |
|
93 | - * @param string $url |
|
94 | - * @return bool |
|
95 | - * @throws HintException |
|
96 | - */ |
|
97 | - protected function checkServer($url) { |
|
98 | - if ($this->trustedServers->isTrustedServer($url) === true) { |
|
99 | - $message = 'Server is already in the list of trusted servers.'; |
|
100 | - $hint = $this->l->t('Server is already in the list of trusted servers.'); |
|
101 | - throw new HintException($message, $hint); |
|
102 | - } |
|
90 | + /** |
|
91 | + * check if the server should be added to the list of trusted servers or not |
|
92 | + * |
|
93 | + * @param string $url |
|
94 | + * @return bool |
|
95 | + * @throws HintException |
|
96 | + */ |
|
97 | + protected function checkServer($url) { |
|
98 | + if ($this->trustedServers->isTrustedServer($url) === true) { |
|
99 | + $message = 'Server is already in the list of trusted servers.'; |
|
100 | + $hint = $this->l->t('Server is already in the list of trusted servers.'); |
|
101 | + throw new HintException($message, $hint); |
|
102 | + } |
|
103 | 103 | |
104 | - if ($this->trustedServers->isOwnCloudServer($url) === false) { |
|
105 | - $message = 'No server to federate with found'; |
|
106 | - $hint = $this->l->t('No server to federate with found'); |
|
107 | - throw new HintException($message, $hint); |
|
108 | - } |
|
104 | + if ($this->trustedServers->isOwnCloudServer($url) === false) { |
|
105 | + $message = 'No server to federate with found'; |
|
106 | + $hint = $this->l->t('No server to federate with found'); |
|
107 | + throw new HintException($message, $hint); |
|
108 | + } |
|
109 | 109 | |
110 | - return true; |
|
111 | - } |
|
110 | + return true; |
|
111 | + } |
|
112 | 112 | } |
@@ -35,19 +35,19 @@ |
||
35 | 35 | |
36 | 36 | class Application extends App implements IBootstrap { |
37 | 37 | |
38 | - /** |
|
39 | - * @param array $urlParams |
|
40 | - */ |
|
41 | - public function __construct($urlParams = []) { |
|
42 | - parent::__construct('federation', $urlParams); |
|
43 | - } |
|
38 | + /** |
|
39 | + * @param array $urlParams |
|
40 | + */ |
|
41 | + public function __construct($urlParams = []) { |
|
42 | + parent::__construct('federation', $urlParams); |
|
43 | + } |
|
44 | 44 | |
45 | - public function register(IRegistrationContext $context): void { |
|
46 | - $context->registerMiddleware(AddServerMiddleware::class); |
|
45 | + public function register(IRegistrationContext $context): void { |
|
46 | + $context->registerMiddleware(AddServerMiddleware::class); |
|
47 | 47 | |
48 | - $context->registerEventListener(SabrePluginAuthInitEvent::class, SabrePluginAuthInitListener::class); |
|
49 | - } |
|
48 | + $context->registerEventListener(SabrePluginAuthInitEvent::class, SabrePluginAuthInitListener::class); |
|
49 | + } |
|
50 | 50 | |
51 | - public function boot(IBootContext $context): void { |
|
52 | - } |
|
51 | + public function boot(IBootContext $context): void { |
|
52 | + } |
|
53 | 53 | } |