Skip to content

Commit 2e582d9

Browse files
authored
Merge pull request #589 from sammyskills/fix/update-groups-permissions-redirects
Fix: groups and permissions filter redirects
2 parents dbb923f + 98d0d04 commit 2e582d9

File tree

3 files changed

+0
-40
lines changed

3 files changed

+0
-40
lines changed

src/Filters/AbstractAuthFilter.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ public function before(RequestInterface $request, $arguments = null)
3737
return;
3838
}
3939

40-
// If the previous_url is from this site, then
41-
// we can redirect back to it.
42-
if (strpos(previous_url(), site_url()) === 0) {
43-
return redirect()->back()->with('error', lang('Auth.notEnoughPrivilege'));
44-
}
45-
4640
// Otherwise, we'll just send them to the home page.
4741
return redirect()->to('/')->with('error', lang('Auth.notEnoughPrivilege'));
4842
}

tests/Authentication/Filters/GroupFilterTest.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,4 @@ public function testFilterIncorrectGroupNoPrevious(): void
6363
// Should have error message
6464
$result->assertSessionHas('error');
6565
}
66-
67-
public function testFilterIncorrectGroupWithPrevious(): void
68-
{
69-
/** @var User $user */
70-
$user = fake(UserModel::class);
71-
$user->addGroup('beta');
72-
73-
$result = $this
74-
->actingAs($user)
75-
->withSession(['_ci_previous_url' => site_url('open-route')])
76-
->get('protected-route');
77-
78-
// Should redirect to the previous url (open-route)
79-
$result->assertRedirectTo(site_url('open-route'));
80-
81-
$result->assertSessionHas('error');
82-
}
8366
}

tests/Authentication/Filters/PermissionFilterTest.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,4 @@ public function testFilterIncorrectGroupNoPrevious(): void
6363
// Should have error message
6464
$result->assertSessionHas('error');
6565
}
66-
67-
public function testFilterIncorrectGroupWithPrevious(): void
68-
{
69-
/** @var User $user */
70-
$user = fake(UserModel::class);
71-
$user->addPermission('beta.access');
72-
73-
$result = $this
74-
->actingAs($user)
75-
->withSession(['_ci_previous_url' => site_url('open-route')])
76-
->get('protected-route');
77-
78-
// Should redirect to the previous url (open-route)
79-
$result->assertRedirectTo(site_url('open-route'));
80-
81-
$result->assertSessionHas('error');
82-
}
8366
}

0 commit comments

Comments
 (0)