From dd88b06bb07133cce5bc65b61caf9acf414f000e Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 24 Feb 2023 12:16:40 +1100 Subject: [PATCH] minor fixes for auth gate on destroy scheduler --- app/Http/Controllers/TaskSchedulerController.php | 2 +- .../TaskScheduler/DestroySchedulerRequest.php | 2 +- app/PaymentDrivers/StripePaymentDriver.php | 11 +---------- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/app/Http/Controllers/TaskSchedulerController.php b/app/Http/Controllers/TaskSchedulerController.php index 6de1bd1581d9..e16abab562be 100644 --- a/app/Http/Controllers/TaskSchedulerController.php +++ b/app/Http/Controllers/TaskSchedulerController.php @@ -12,7 +12,7 @@ namespace App\Http\Controllers; use App\Factory\SchedulerFactory; -use App\Http\Requests\Task\DestroySchedulerRequest; +use App\Http\Requests\TaskScheduler\DestroySchedulerRequest; use App\Http\Requests\TaskScheduler\CreateSchedulerRequest; use App\Http\Requests\TaskScheduler\ShowSchedulerRequest; use App\Http\Requests\TaskScheduler\StoreSchedulerRequest; diff --git a/app/Http/Requests/TaskScheduler/DestroySchedulerRequest.php b/app/Http/Requests/TaskScheduler/DestroySchedulerRequest.php index 6ca63ce4a475..c1225e42cd31 100644 --- a/app/Http/Requests/TaskScheduler/DestroySchedulerRequest.php +++ b/app/Http/Requests/TaskScheduler/DestroySchedulerRequest.php @@ -22,6 +22,6 @@ class DestroySchedulerRequest extends Request */ public function authorize() : bool { - return auth()->user()->isAdmin(); + return auth()->user()->isAdmin() && $this->task_scheduler->company_id == auth()->user()->company()->id; } } diff --git a/app/PaymentDrivers/StripePaymentDriver.php b/app/PaymentDrivers/StripePaymentDriver.php index 99c8e1f3c404..cfe1b57a6c65 100644 --- a/app/PaymentDrivers/StripePaymentDriver.php +++ b/app/PaymentDrivers/StripePaymentDriver.php @@ -155,7 +155,7 @@ class StripePaymentDriver extends BaseDriver if ($this->client && isset($this->client->country) - && in_array($this->client->country->iso_3166_3, ['USA']) + && (in_array($this->client->country->iso_3166_3, ['USA']) || ($this->client->gateway_tokens()->where('gateway_type_id', GatewayType::BANK_TRANSFER)->exists())) ) { $types[] = GatewayType::BANK_TRANSFER; } @@ -843,15 +843,6 @@ class StripePaymentDriver extends BaseDriver $this->client = ClientGatewayToken::where('gateway_customer_reference', $customer)->client; } - /** - * Pull all client payment methods and update - * the respective tokens in the system. - */ - public function updateAllPaymentMethods() - { - return (new UpdatePaymentMethods($this))->run(); - } - /** * Imports stripe customers and their payment methods * Matches users in the system based on the $match_on_record