Skip to content

A free open source IT asset/license management system

safety stuff

spencerrlongg18720b330250
diff --git a/app/Http/Livewire/OauthClients.php b/app/Http/Livewire/OauthClients.php
index 98582c0725..39813a50d7 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 bb43fccbdb..be03c3518f 100644
--- a/resources/views/livewire/oauth-clients.blade.php
+++ b/resources/views/livewire/oauth-clients.blade.php
@@ -5,6 +5,13 @@
<h2>
(Livewire) OAuth Clients
</h2>
+ @if($authorizationError)
+ <div class="alert alert-danger">
+ <p><strong>Whoops!</strong> Something went wrong!</p>
+ <br>
+ {{ $authorizationError }}
+ </div>
+ @endif
<a class="button button-small"
wire:click="$emit('openModal')"
@@ -183,7 +190,7 @@
@if($errors->has('newRedirect'))
<li>{{ $errors->first('newRedirect') }}</li>
@endif
- @if($authCodeError)
+ @if($authorizationError)
<li>{{ $authorizationError }}</li>
@endif
</ul>