84eb0e2c21
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
77 lines
1.8 KiB
PHP
77 lines
1.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace KTXC\Security\Event;
|
|
|
|
use KTXF\Event\Event;
|
|
|
|
final class FirewallSettingsUpdatedEvent extends Event implements SecurityEventInterface
|
|
{
|
|
public function __construct(
|
|
private readonly string $changeReason,
|
|
private readonly array $previous,
|
|
private readonly array $current,
|
|
string $tenantId,
|
|
?string $actorId = null,
|
|
private readonly string $changeOrigin = 'manual',
|
|
) {
|
|
if ($changeReason === '') {
|
|
throw new \InvalidArgumentException('Firewall settings updates require a change reason.');
|
|
}
|
|
if ($tenantId === '') {
|
|
throw new \InvalidArgumentException('Firewall settings updates require a tenant ID.');
|
|
}
|
|
if ($changeOrigin === '') {
|
|
throw new \InvalidArgumentException('Firewall settings updates require a change origin.');
|
|
}
|
|
|
|
parent::__construct(
|
|
self::class,
|
|
[
|
|
'changeReason' => $changeReason,
|
|
'changeOrigin' => $changeOrigin,
|
|
'previous' => $previous,
|
|
'current' => $current,
|
|
],
|
|
$tenantId,
|
|
$actorId,
|
|
);
|
|
}
|
|
|
|
public function getChangeReason(): string
|
|
{
|
|
return $this->changeReason;
|
|
}
|
|
|
|
public function getPrevious(): array
|
|
{
|
|
return $this->previous;
|
|
}
|
|
|
|
public function getCurrent(): array
|
|
{
|
|
return $this->current;
|
|
}
|
|
|
|
public function getChangeOrigin(): string
|
|
{
|
|
return $this->changeOrigin;
|
|
}
|
|
|
|
public function getUserId(): ?string
|
|
{
|
|
return null;
|
|
}
|
|
|
|
public function getReason(): string
|
|
{
|
|
return $this->changeReason;
|
|
}
|
|
|
|
public function getSeverity(): SecurityEventSeverity
|
|
{
|
|
return SecurityEventSeverity::INFO;
|
|
}
|
|
}
|