minor fixes for auth gate on destroy scheduler

This commit is contained in:
David Bomba 2023-02-24 12:16:40 +11:00
parent b1cef2900b
commit dd88b06bb0
3 changed files with 3 additions and 12 deletions

View File

@ -12,7 +12,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Factory\SchedulerFactory; 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\CreateSchedulerRequest;
use App\Http\Requests\TaskScheduler\ShowSchedulerRequest; use App\Http\Requests\TaskScheduler\ShowSchedulerRequest;
use App\Http\Requests\TaskScheduler\StoreSchedulerRequest; use App\Http\Requests\TaskScheduler\StoreSchedulerRequest;

View File

@ -22,6 +22,6 @@ class DestroySchedulerRequest extends Request
*/ */
public function authorize() : bool public function authorize() : bool
{ {
return auth()->user()->isAdmin(); return auth()->user()->isAdmin() && $this->task_scheduler->company_id == auth()->user()->company()->id;
} }
} }

View File

@ -155,7 +155,7 @@ class StripePaymentDriver extends BaseDriver
if ($this->client if ($this->client
&& isset($this->client->country) && 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; $types[] = GatewayType::BANK_TRANSFER;
} }
@ -843,15 +843,6 @@ class StripePaymentDriver extends BaseDriver
$this->client = ClientGatewayToken::where('gateway_customer_reference', $customer)->client; $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 * Imports stripe customers and their payment methods
* Matches users in the system based on the $match_on_record * Matches users in the system based on the $match_on_record