You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.5 KiB
PHP
48 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
use App\Services\Cloud\CloudAccess;
|
|
use App\Services\Cloud\CloudAdminAbuseAlertHistoryService;
|
|
use App\Services\Cloud\CloudAdminAbuseMonitoringService;
|
|
|
|
/** Administrator-only, observe-only network-abuse monitoring API. */
|
|
final class CloudAdminAbuseMonitoringController
|
|
{
|
|
public function index($request, $response)
|
|
{
|
|
$actor = $request->getAttribute('cloud_actor')
|
|
?? CloudAccess::actor(false);
|
|
$payload = (new CloudAdminAbuseMonitoringService())->page(
|
|
$actor,
|
|
$request->getQueryParams()
|
|
);
|
|
return $response->withJson($payload)
|
|
->withHeader('Cache-Control', 'private, no-store');
|
|
}
|
|
|
|
public function detail($request, $response, array $args)
|
|
{
|
|
$actor = $request->getAttribute('cloud_actor')
|
|
?? CloudAccess::actor(false);
|
|
$payload = (new CloudAdminAbuseMonitoringService())->detail(
|
|
$actor,
|
|
$args['id'] ?? ''
|
|
);
|
|
return $response->withJson($payload)
|
|
->withHeader('Cache-Control', 'private, no-store');
|
|
}
|
|
|
|
public function alerts($request, $response)
|
|
{
|
|
$actor = $request->getAttribute('cloud_actor')
|
|
?? CloudAccess::actor(false);
|
|
$payload = (new CloudAdminAbuseAlertHistoryService())->page(
|
|
$actor,
|
|
$request->getQueryParams()
|
|
);
|
|
return $response->withJson($payload)
|
|
->withHeader('Cache-Control', 'private, no-store');
|
|
}
|
|
}
|