mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-12 13:58:12 +02:00
Improved CP error handling and audit log
This commit is contained in:
parent
0c6cb72852
commit
18e6eafb41
5 changed files with 113 additions and 3 deletions
22
cp/app/Middleware/AuditMiddleware.php
Normal file
22
cp/app/Middleware/AuditMiddleware.php
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace App\Middleware;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Http\Server\RequestHandlerInterface as RequestHandler;
|
||||
use Pinga\Session;
|
||||
|
||||
class AuditMiddleware extends Middleware
|
||||
{
|
||||
|
||||
public function __invoke(Request $request, RequestHandler $handler)
|
||||
{
|
||||
if (isset($_SESSION['auth_user_id'])) {
|
||||
$userId = (int)$_SESSION['auth_user_id'];
|
||||
$this->container->get('db')->exec("SET @audit_usr_id = $userId");
|
||||
$this->container->get('db')->exec("SET @audit_ses_id = " . crc32(\Pinga\Session\Session::id()));
|
||||
}
|
||||
return $handler->handle($request);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue