Skip to content

Commit

Permalink
Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
svewap committed Oct 27, 2024
1 parent e4ea7f5 commit ebf1a94
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Classes/Authentication/KeyAuthenticationProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class KeyAuthenticationProvider
* @param $key
* @return bool
*/
public function hasValidKey($key)
public function hasValidKey($key): bool
{
$config = Configuration::getExtConfiguration();
return trim($config['apiKey']) === trim($key);
}


}
}
4 changes: 2 additions & 2 deletions Classes/Middleware/ZabbixClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private function processRequest(ServerRequestInterface $request)
return $response->withStatus(403, 'Not allowed');
}

$key = $request->getParsedBody()['key'] ?? $request->getQueryParams()['key'] ?? null;
$key = $request->getParsedBody()['key'] ?? $request->getQueryParams()['key'] ?? '';
$keyAuthenticationProvider = new KeyAuthenticationProvider();
if (!$keyAuthenticationProvider->hasValidKey($key)) {
/** @var Response $response */
Expand All @@ -89,7 +89,7 @@ private function processRequest(ServerRequestInterface $request)
$GLOBALS['TYPO3_REQUEST'] = (new ServerRequest())->withAttribute(
'applicationType',
SystemEnvironmentBuilder::REQUESTTYPE_BE
)->withAttribute('frontend.typoscript',new FrontendTypoScript(new RootNode(),[]));
)->withAttribute('frontend.typoscript',new FrontendTypoScript(new RootNode(),[],[],[]));

if ($operation !== null && $operation !== '') {
try {
Expand Down
2 changes: 2 additions & 0 deletions Classes/Operation/HasForbiddenUsers.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* LICENSE.txt file that was distributed with this source code.
*/

use Doctrine\DBAL\Exception;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\SingletonInterface;
Expand All @@ -29,6 +30,7 @@ class HasForbiddenUsers implements IOperation, SingletonInterface
*
* @param array $parameter None
* @return OperationResult
* @throws Exception
*/
public function execute(array $parameter = []): OperationResult
{
Expand Down

0 comments on commit ebf1a94

Please sign in to comment.