From 122798ec8da9250bbb13f3ba25489dff22e828ac Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Wed, 20 Apr 2022 14:38:00 +0200 Subject: [PATCH] #118 - fix --- app/Infrastructure/Http/Controllers/KeysController.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Infrastructure/Http/Controllers/KeysController.php b/app/Infrastructure/Http/Controllers/KeysController.php index 6482823..096e540 100644 --- a/app/Infrastructure/Http/Controllers/KeysController.php +++ b/app/Infrastructure/Http/Controllers/KeysController.php @@ -41,7 +41,7 @@ class KeysController extends Controller */ public function store(Request $request): RedirectResponse { - $this->authorize("manageKeys"); + $this->authorize("manage", Key::class); $key = $request->user()->keys()->create(); @@ -68,8 +68,13 @@ class KeysController extends Controller ])); } + /** + * @throws AuthorizationException + */ public function give(Key $key, GiveKeyRequest $request): RedirectResponse { + $this->authorize("give", $key); + $recipient = $request->recipient(); $key->user()->associate($recipient); @@ -86,7 +91,7 @@ class KeysController extends Controller public function destroy(Key $key): RedirectResponse { - $this->authorize("manageKeys"); + $this->authorize("manage", Key::class); $key->delete();