Add audit log entry for deleted blacklist records
Some checks are pending
CI / generate-phpdoc (push) Blocked by required conditions
CI / release (push) Waiting to run
CI / debug (push) Waiting to run
CI / check-phpunit (push) Waiting to run
CI / check-phpdoc (push) Waiting to run
CI / test (push) Blocked by required conditions
CI / release-documentation (push) Blocked by required conditions
CI / release-artifacts (push) Blocked by required conditions

This commit is contained in:
netkas 2025-06-06 18:22:30 -04:00
parent 8ec47c855f
commit bda91ff955
Signed by: netkas
GPG key ID: 4D8629441B76E4CC
2 changed files with 12 additions and 1 deletions

View file

@ -19,4 +19,6 @@
case ENTITY_DISCOVERED = 'ENTITY_DISCOVERED';
case ENTITY_BLACKLISTED = 'ENTITY_BLACKLISTED';
case ENTITY_UNBLACKLISTED = 'ENTITY_UNBLACKLISTED';
case BLACKLIST_RECORD_DELETED = 'BLACKLIST_RECORD_DELETED';
}

View file

@ -3,6 +3,8 @@
namespace FederationServer\Methods\Blacklist;
use FederationServer\Classes\Configuration;
use FederationServer\Classes\Enums\AuditLogType;
use FederationServer\Classes\Managers\AuditLogManager;
use FederationServer\Classes\Managers\BlacklistManager;
use FederationServer\Classes\RequestHandler;
use FederationServer\Classes\Validate;
@ -36,12 +38,19 @@
try
{
if(!BlacklistManager::blacklistExists($blacklistUuid))
$blacklistRecord = BlacklistManager::getBlacklistEntry($blacklistUuid);
if($blacklistRecord === null)
{
throw new RequestException('Blacklist record not found', 404);
}
BlacklistManager::deleteBlacklistRecord($blacklistUuid);
AuditLogManager::createEntry(AuditLogType::BLACKLIST_RECORD_DELETED, sprintf(
'Blacklist record %s deleted by %s (%s)',
$blacklistUuid,
$authenticatedOperator->getName(),
$authenticatedOperator->getUuid()
), $authenticatedOperator->getUuid(), $blacklistRecord->getEntity());
}
catch (DatabaseOperationException $e)
{