diff --git a/app/Http/Livewire/OauthClients.php b/app/Http/Livewire/OauthClients.php index 98582c072..39813a50d 100644 --- a/app/Http/Livewire/OauthClients.php +++ b/app/Http/Livewire/OauthClients.php @@ -52,7 +52,12 @@ class OauthClients extends Component { // test for safety // ->delete must be of type Client - thus the model binding - $this->clientRepository->delete($clientId); + if ($clientId->user_id == auth()->user()->id) { + $this->clientRepository->delete($clientId); + } else { + Log::warning('User ' . auth()->user()->id . ' attempted to delete client ' . $clientId->id . ' which belongs to user ' . $clientId->user_id); + $this->authorizationError = 'You are not authorized to delete this client.'; + } } public function editClient(Client $editClientId): void diff --git a/resources/views/livewire/oauth-clients.blade.php b/resources/views/livewire/oauth-clients.blade.php index bb43fccbd..be03c3518 100644 --- a/resources/views/livewire/oauth-clients.blade.php +++ b/resources/views/livewire/oauth-clients.blade.php @@ -5,6 +5,13 @@
Whoops! Something went wrong!
+