Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
GetAppStatisticsCredentialsEndpoint | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
handle | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | |
3 | namespace Olz\Apps\Statistics\Endpoints; |
4 | |
5 | use Olz\Api\OlzTypedEndpoint; |
6 | use PhpTypeScriptApi\HttpError; |
7 | |
8 | /** |
9 | * @extends OlzTypedEndpoint< |
10 | * array{}, |
11 | * array{username: string, password: string} |
12 | * > |
13 | */ |
14 | class GetAppStatisticsCredentialsEndpoint 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("Statistics credentials access by {$user?->getUsername()}."); |
22 | |
23 | return [ |
24 | 'username' => $this->envUtils()->getAppStatisticsUsername(), |
25 | 'password' => $this->envUtils()->getAppStatisticsPassword(), |
26 | ]; |
27 | } |
28 | } |