Skip to content

Commit 118d380

Browse files
Merge pull request #2211 from nextcloud/fix/noid/test-while-check
allow test during :check
2 parents eb2f871 + 89f7b72 commit 118d380

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

lib/Command/CirclesCheck.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ private function testLoopback(InputInterface $input, OutputInterface $output): b
260260
return false;
261261
}
262262

263+
$this->appConfig->setValueInt(Application::APP_ID, 'test_dummy_token', time() + 10);
263264
if (!$this->testRequest(
264265
$output, 'POST', 'circles.EventWrapper.asyncBroadcast',
265266
['token' => 'test-dummy-token']

lib/Controller/EventWrapperController.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use OCP\AppFramework\Controller;
2323
use OCP\AppFramework\Http;
2424
use OCP\AppFramework\Http\DataResponse;
25+
use OCP\IAppConfig;
2526
use OCP\IRequest;
2627

2728
/**
@@ -64,6 +65,7 @@ class EventWrapperController extends Controller {
6465
public function __construct(
6566
string $appName,
6667
IRequest $request,
68+
private readonly IAppConfig $appConfig,
6769
EventWrapperService $eventWrapperService,
6870
FederatedEventService $federatedEventService,
6971
RemoteUpstreamService $remoteUpstreamService,
@@ -101,6 +103,10 @@ public function asyncBroadcast(string $token): DataResponse {
101103
return new DataResponse([], Http::STATUS_OK);
102104
}
103105

106+
if ($token === 'test-dummy-token' && $this->appConfig->getValueInt(Application::APP_ID, 'test_dummy_token') < time()) {
107+
return new DataResponse([], Http::STATUS_UNAUTHORIZED);
108+
}
109+
104110
// closing socket, keep current process running.
105111
$this->async();
106112

0 commit comments

Comments
 (0)