mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 12:44:35 -04:00
Fixes for project form request authorization
This commit is contained in:
parent
ec67d019c7
commit
83c3b3d923
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Requests\Project;
|
namespace App\Http\Requests\Project;
|
||||||
|
|
||||||
|
use App\Models\Project;
|
||||||
use App\Http\Requests\Request;
|
use App\Http\Requests\Request;
|
||||||
|
|
||||||
class CreateProjectRequest extends Request
|
class CreateProjectRequest extends Request
|
||||||
@ -22,6 +23,7 @@ class CreateProjectRequest extends Request
|
|||||||
*/
|
*/
|
||||||
public function authorize() : bool
|
public function authorize() : bool
|
||||||
{
|
{
|
||||||
return auth()->user()->isAdmin();
|
return auth()->user()->can('create', Project::class);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,6 @@ class DestroyProjectRequest extends Request
|
|||||||
*/
|
*/
|
||||||
public function authorize() : bool
|
public function authorize() : bool
|
||||||
{
|
{
|
||||||
return auth()->user()->isAdmin();
|
return auth()->user()->can('edit', $this->project);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ class EditProjectRequest extends Request
|
|||||||
*/
|
*/
|
||||||
public function authorize() : bool
|
public function authorize() : bool
|
||||||
{
|
{
|
||||||
return auth()->user()->isAdmin();
|
return auth()->user()->can('edit', $this->project);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,7 +22,9 @@ class ShowProjectRequest extends Request
|
|||||||
*/
|
*/
|
||||||
public function authorize() : bool
|
public function authorize() : bool
|
||||||
{
|
{
|
||||||
return auth()->user()->isAdmin();
|
// return auth()->user()->isAdmin();
|
||||||
|
return auth()->user()->can('view', $this->project);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user