Added Gate authorization arguments

Gate Auth arguments were missing for TeamFile and Team controllers.
This means that Gate has no idea where to look for policies, meaning that
the ability passed is perceived literally, causing an Unauthorized error.

Adding the Model with which to authorize the request solved the error since
Gate now knows which policy to look in for permission logic.
This commit is contained in:
2020-12-21 01:02:05 +00:00
parent 2f0fc14825
commit 1c0eeb4bb0
2 changed files with 27 additions and 23 deletions

View File

@@ -32,7 +32,7 @@ class TeamFileController extends Controller
*/
public function index(Request $request)
{
$this->authorize('index');
$this->authorize('index', TeamFile::class);
if (is_null(Auth::user()->currentTeam))
{
@@ -53,7 +53,7 @@ class TeamFileController extends Controller
*/
public function store(UploadFileRequest $request)
{
$this->authorize('store');
$this->authorize('store', TeamFile::class);
$upload = $request->file('file');
@@ -87,7 +87,7 @@ class TeamFileController extends Controller
public function download(Request $request, TeamFile $teamFile)
{
$this->authorize('download');
$this->authorize('download', TeamFile::class);
try
{
@@ -133,7 +133,7 @@ class TeamFileController extends Controller
*/
public function destroy(Request $request, TeamFile $teamFile)
{
$this->authorize('delete');
$this->authorize('delete', $teamFile);
try
{