RVRNEXT-5 fix audit logger for non-web access

This commit is contained in:
Bence Pőcze 2023-04-28 20:58:19 +02:00
parent 882b326aca
commit 0b261b6272
Signed by: bence
GPG Key ID: DC5BD6E95A333E6D
2 changed files with 6 additions and 3 deletions

View File

@ -17,9 +17,9 @@ class Container
static SokoWeb\Interfaces\Database\IConnection $dbConnection; static SokoWeb\Interfaces\Database\IConnection $dbConnection;
static SokoWeb\Interfaces\Database\IAuditLogger $auditLogger; static SokoWeb\Interfaces\Database\IAuditLogger $auditLogger;
static SokoWeb\Interfaces\PersistentData\IPersistentDataManager $persistentDataManager; static SokoWeb\Interfaces\PersistentData\IPersistentDataManager $persistentDataManager;
static SokoWeb\Interfaces\Routing\IRouteCollection $routeCollection; static ?SokoWeb\Interfaces\Routing\IRouteCollection $routeCollection = null;
static SokoWeb\Interfaces\Session\ISessionHandler $sessionHandler; static ?SokoWeb\Interfaces\Session\ISessionHandler $sessionHandler = null;
static SokoWeb\Interfaces\Request\IRequest $request; static ?SokoWeb\Interfaces\Request\IRequest $request = null;
} }
Container::$dbConnection = new SokoWeb\Database\Mysql\Connection($_ENV['DB_HOST'], $_ENV['DB_USER'], $_ENV['DB_PASSWORD'], $_ENV['DB_NAME']); Container::$dbConnection = new SokoWeb\Database\Mysql\Connection($_ENV['DB_HOST'], $_ENV['DB_USER'], $_ENV['DB_PASSWORD'], $_ENV['DB_NAME']);

View File

@ -6,6 +6,9 @@ class AuditLogger extends AuditLoggerBase
{ {
protected function getModifierId() protected function getModifierId()
{ {
if (\Container::$request === null) {
return null;
}
$user = \Container::$request->user(); $user = \Container::$request->user();
if ($user === null) { if ($user === null) {
return null; return null;