Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
GetAppMonitoringCredentialsEndpoint | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
4 | |
100.00% |
1 / 1 |
handle | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
4 |
1 | <?php |
2 | |
3 | namespace Olz\Apps\Monitoring\Endpoints; |
4 | |
5 | use Olz\Api\OlzTypedEndpoint; |
6 | use PhpTypeScriptApi\HttpError; |
7 | |
8 | /** |
9 | * @extends OlzTypedEndpoint< |
10 | * ?array{}, |
11 | * array{username: non-empty-string, password: non-empty-string} |
12 | * > |
13 | */ |
14 | class GetAppMonitoringCredentialsEndpoint extends OlzTypedEndpoint { |
15 | protected function handle(mixed $input): mixed { |
16 | if (!$this->authUtils()->hasPermission('all')) { |
17 | throw new HttpError(403, "Kein Zugriff!"); |
18 | } |
19 | |
20 | $user = $this->authUtils()->getCurrentUser(); |
21 | $this->log()->info("Monitoring credentials access by {$user?->getUsername()}."); |
22 | |
23 | return [ |
24 | 'username' => $this->envUtils()->getAppMonitoringUsername() ?: '-', |
25 | 'password' => $this->envUtils()->getAppMonitoringPassword() ?: '-', |
26 | ]; |
27 | } |
28 | } |