@@ -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 | } |