mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for task scheduler
This commit is contained in:
parent
010f324b4c
commit
25d0640135
@ -22,6 +22,6 @@ class ShowSchedulerRequest extends Request
|
||||
*/
|
||||
public function authorize() : bool
|
||||
{
|
||||
return auth()->user()->can('view', $this->scheduler);
|
||||
return auth()->user()->can('view', $this->task_scheduler);
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ class UpdateSchedulerRequest extends Request
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return auth()->user()->isAdmin();
|
||||
return auth()->user()->isAdmin() && $this->task_scheduler->company_id == auth()->user()->company()->id;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
|
@ -54,6 +54,22 @@ class SchedulerTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testSchedulerGet2()
|
||||
{
|
||||
|
||||
$scheduler = SchedulerFactory::create($this->company->id, $this->user->id);
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->get('/api/v1/task_schedulers/'.$this->encodePrimaryKey($scheduler->id));
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
|
||||
public function testCustomDateRanges()
|
||||
{
|
||||
$data = [
|
||||
@ -619,21 +635,6 @@ class SchedulerTest extends TestCase
|
||||
}
|
||||
|
||||
|
||||
// public function testSchedulerPut()
|
||||
// {
|
||||
// $data = [
|
||||
// 'description' => $this->faker->firstName(),
|
||||
// ];
|
||||
|
||||
// $response = $this->withHeaders([
|
||||
// 'X-API-SECRET' => config('ninja.api_secret'),
|
||||
// 'X-API-TOKEN' => $this->token,
|
||||
// ])->put('/api/v1/task_schedulers/'.$this->encodePrimaryKey($this->task->id), $data);
|
||||
|
||||
// $response->assertStatus(200);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// public function testSchedulerCantBeCreatedWithWrongData()
|
||||
// {
|
||||
|
Loading…
x
Reference in New Issue
Block a user