Skip to content

Commit

Permalink
[2.x] Fix permissions for team create routes (#669)
Browse files Browse the repository at this point in the history
* Fix permissions for team create routes

* Update TeamController.php

* Update TeamController.php

* Update TeamController.php

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
driesvints and taylorotwell authored Feb 9, 2021
1 parent 15e8b37 commit 355262d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Http/Controllers/Inertia/TeamController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ public function show(Request $request, $teamId)
{
$team = Jetstream::newTeamModel()->findOrFail($teamId);

if (Gate::denies('view', $team)) {
abort(403);
}
Gate::authorize('view', $team);

return Jetstream::inertia()->render($request, 'Teams/Show', [
'team' => $team->load('owner', 'users', 'teamInvitations'),
Expand All @@ -54,6 +52,8 @@ public function show(Request $request, $teamId)
*/
public function create(Request $request)
{
Gate::authorize('create', Jetstream::newTeamModel());

return Inertia::render('Teams/Create');
}

Expand Down
2 changes: 2 additions & 0 deletions src/Http/Controllers/Livewire/TeamController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public function show(Request $request, $teamId)
*/
public function create(Request $request)
{
Gate::authorize('create', Jetstream::newTeamModel());

return view('teams.create', [
'user' => $request->user(),
]);
Expand Down

0 comments on commit 355262d

Please sign in to comment.