Implement webhook inspector

This commit is contained in:
2026-08-04 17:09:39 +02:00
parent b021836c14
commit 75d8b25b64
57 changed files with 5110 additions and 230 deletions
+41
View File
@@ -0,0 +1,41 @@
<?php
namespace App\Policies;
use App\Models\User;
use App\Models\WebhookRequest;
class WebhookRequestPolicy
{
public function viewAny(?User $user): bool
{
return $user !== null;
}
public function view(?User $user, WebhookRequest $webhookRequest): bool
{
return $this->canAccessEndpoint($user, $webhookRequest);
}
public function create(?User $user): bool
{
return false;
}
public function update(?User $user, WebhookRequest $webhookRequest): bool
{
return false;
}
public function delete(?User $user, WebhookRequest $webhookRequest): bool
{
return $this->canAccessEndpoint($user, $webhookRequest);
}
private function canAccessEndpoint(?User $user, WebhookRequest $webhookRequest): bool
{
$webhookRequest->loadMissing('endpoint');
return (new WebhookEndpointPolicy)->view($user, $webhookRequest->endpoint);
}
}